git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: git@vger.kernel.org
Subject: Strange git merge behaviour with empty branches
Date: Mon, 19 Mar 2012 18:53:49 +0000	[thread overview]
Message-ID: <20120319185349.GH12789@mudshark.cambridge.arm.com> (raw)

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

             reply	other threads:[~2012-03-19 18:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-19 18:53 Will Deacon [this message]
2012-03-19 19:51 ` Strange git merge behaviour with empty branches Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120319185349.GH12789@mudshark.cambridge.arm.com \
    --to=will.deacon@arm.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).