[bind10-dev] Order of merging

Stephen Morris stephen at isc.org
Wed Jan 23 11:13:41 UTC 2013


On 21/01/13 15:54, Michal 'vorner' Vaner wrote:
> Hello
> 
> I'd like to ask for one small thing. When you're merging a branch,
> to master, do that and not the other way around, eg:
> 
> $ git checkout master $ git merge tracXXXX
> 
> Not: $ git checkout tracXXXX $ git merge master $ git checkout
> master $ git merge tracXXXX

I prefer merging master into the branch simply because if there are
conflicts, it may take me time to resolve them.  In that time, master
may have changed, possibly leading to additional conflicts; having the
work on the branch makes it easier to perform another merge, as well
as making it easier to checkpoint and save intermediate work.

I'd also argue that its safer - the less time you spend with master as
your current branch, the less chance there is that you push something
that won't build.

> The second creates stupid message of merging master to branch,
> while the other is actually true.
> 
> Also, with doing the second, if you use some graphical history 
> browser (like qgit, gitk, gitview, …), the master branch moves from
> place to place. With the first approach, the master stays on the
> left side all the time, making it much more understandable.
> 
> Also, if we ever want to employ some script to extract changelog
> from the merges to master, it would be easier if the master always
> followed on the first parent, eg. on the left.

How likely is this?  We already maintain a separate change log, as not
every change to master requires a entry.  Besides, if we were to do
that we should also use --squash when merging into master so as to
remove the clutter of intermediate commits.

Having said that, perhaps a solution that satisfies both preferences is:

$ git checkout tracXXXX
$ git merge master
$ git checkout master
$ git merge --no-ff tracXXXX

The last command will force a new commit into master, even if one were
not necessary, so simulating the effect of directly merging the branch
into it.

Stephen


More information about the bind10-dev mailing list