Skip to content

Commit 3de6edd

Browse files
committed
Updates to git flow documentation.
1 parent c96b31b commit 3de6edd

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

doc/workflow/gitlab_flow.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,15 @@ If you have an issue that spans across multiple repositories, the best thing is
187187
![Vim screen showing the rebase view](rebase.png)
188188

189189
With git you can use an interactive rebase (`rebase -i`) to squash multiple commits into one and reorder them.
190+
In GitLab EE and .com you can also [rebase before merge](http://doc.gitlab.com/ee/workflow/rebase_before_merge.html) from the web interface.
190191
This functionality is useful if you made a couple of commits for small changes during development and want to replace them with a single commit or if you want to make the order more logical.
191192
However you should never rebase commits you have pushed to a remote server.
192193
Somebody can have referred to the commits or cherry-picked them.
193194
When you rebase you change the identifier (SHA-1) of the commit and this is confusing.
194195
If you do that the same change will be known under multiple identifiers and this can cause much confusion.
195196
If people already reviewed your code it will be hard for them to review only the improvements you made since then if you have rebased everything into one commit.
197+
Another reasons not to rebase is that you lose authorship information, maybe someone created a merge request, another person pushed a commit on there to improve it and a third one merged it.
198+
In this case rebasing all the commits into one prevent the other authors from being properly attributed and sharing part of the [git blame](https://git-scm.com/docs/git-blame).
196199

197200
People are encouraged to commit often and to frequently push to the remote repository so other people are aware what everyone is working on.
198201
This will lead to many commits per change which makes the history harder to understand.
@@ -221,13 +224,11 @@ You can reuse recorded resolutions (rerere) sometimes, but without rebasing you
221224
There has to be a better way to avoid many merge commits.
222225

223226
The way to prevent creating many merge commits is to not frequently merge master into the feature branch.
224-
We'll discuss the three reasons to merge in master: leveraging code, solving merge conflicts and long running branches.
227+
We'll discuss the three reasons to merge in master: leveraging code, merge conflicts, and long running branches.
225228
If you need to leverage some code that was introduced in master after you created the feature branch you can sometimes solve this by just cherry-picking a commit.
226229
If your feature branch has a merge conflict, creating a merge commit is a normal way of solving this.
227-
You should aim to prevent merge conflicts where they are likely to occur.
228-
One example is the CHANGELOG file where each significant change in the codebase is documented under a version header.
229-
Instead of everyone adding their change at the bottom of the list for the current version it is better to randomly insert it in the current list for that version.
230-
This it is likely that multiple feature branches that add to the CHANGELOG can be merged before a conflict occurs.
230+
You can prevent some merge conflicts by using [gitattributes](http://git-scm.com/docs/gitattributes) for files that can be in a random order.
231+
For example in GitLab our changelog file is specified in .gitattributes as `CHANGELOG merge=union` so that there are fewer merge conflicts in it.
231232
The last reason for creating merge commits is having long lived branches that you want to keep up to date with the latest state of the project.
232233
Martin Fowler, in [his article about feature branches](http://martinfowler.com/bliki/FeatureBranch.html) talks about this Continuous Integration (CI).
233234
At GitLab we are guilty of confusing CI with branch testing. Quoting Martin Fowler: "I've heard people say they are doing CI because they are running builds, perhaps using a CI server, on every branch with every commit.

0 commit comments

Comments
 (0)