git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jan Hudec <bulb@ucw.cz>, git@vger.kernel.org
Subject: Re: [BUG?] git checkout -b removes MERGE_HEAD
Date: Thu, 18 Nov 2010 14:26:47 -0500	[thread overview]
Message-ID: <20101118192647.GD30438@sigill.intra.peff.net> (raw)
In-Reply-To: <7vwroabhng.fsf@alter.siamese.dyndns.org>

On Thu, Nov 18, 2010 at 10:39:31AM -0800, Junio C Hamano wrote:

> I think it was an oversight by the author of 91dcdfd (Make "git checkout"
> create new branches on demand, 2005-07-11) who forgot that he also did
> ef0bfa2 (Remove MERGE_HEAD in "git checkout/reset", 2005-06-21).  The
> rationale for the removal of MERGE_HEAD from the earlier commit is:
> 
>     [this command] will end up resetting the index to some specific
>     head, and any unresolved merge will be forgotten [hence there is no
>     point recording the result as a merge].
> 
> but when used with -b no such "resetting of the index" happens.

It is not necessarily about "-b" is it? It is about moving to a
different commit. So I would think that on branch "master":

  # should clear MERGE_HEAD
  git checkout foo

  # should not clear MERGE_HEAD; it's a no-op, and we have in the past
  # encouraged people to run this to see the ahead/behind count
  git checkout
  # or
  git checkout master

  # should clear MERGE_HEAD; we are moving to a new commit
  git checkout -b foo some_commit

  # should not clear MERGE_HEAD; this is Jan's case
  git checkout -b foo
  # or
  git checkout -b foo master

-Peff

      parent reply	other threads:[~2010-11-18 19:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-18  7:15 [BUG?] git checkout -b removes MERGE_HEAD Jan Hudec
2010-11-18 18:39 ` Junio C Hamano
2010-11-18 19:01   ` Jan Hudec
2010-11-18 19:26   ` Jeff King [this message]

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=20101118192647.GD30438@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=bulb@ucw.cz \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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).