Strange git merge behaviour with empty branches

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello git people,

I'm seeing some strange behaviour with git merge and wondered if you could
help me to understand what's going on.

Say I have a master branch tracking upstream and a few local branches based
off that:

$ git branch
  master
  foo
  bar
  baz

Furthermore, let's say that both foo and bar are currently at master (that
is, they have no additional commits) but baz does have changes committed on
top of master.

Now, if I make an integration branch:

$ git checkout master -b integration

I can then merge foo, bar and baz into this:

$ git merge foo bar baz

which works fine. However, specifying the non-empty branch first does:

$ git merge baz foo bar
Already up-to-date.

and the changes from baz are not merged in. For extra weirdness, if you
have another non-empty branch (qux) and do:

$ git merge baz foo bar qux

Then you end up with a branch that *doesn't* contain baz, *does* contain
qux and has a weird looking merge-commit message that just reads "baz"!

Now, I appreciate that merging in empty branches might seem weird but it's
sometimes useful if you have scripts that take a set of known branches, merge
them and then do a build.

Any thoughts?

Cheers,

Will
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]