git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[BUG?] git checkout -b removes MERGE_HEAD

From
JHJan Hudec <bulb@ucw.cz>
Date
Nov 18, 2010, 07:15 UTC
Message-ID
<456aec650e66bba518b8a5ec88c88a6b.squirrel@artax.karlin.mff.cuni.cz>
Hello all,

I am not sure whether it is a bug or not, but it definitely did surprise me a lot. The use-case was as follows:

 - I checked out master and ran a merge from branch (let's call
   it "branch"). It had a lot of conflicts, so I needed to test
   the result well.
 - During the testing I found a problem, but it may have already
   existed on master before the merge.
 - Therefore I needed to return to clean master, test it and return
   to the merge. So I thought I'd commit the merge to a temporary
   branch, test master again and merge the temporary to master if
   the problem is not from the merge. So I did:
   $ git checkout -b temp
   $ git commit
   OOPS! It forgot it was a merge.

Yes, I could have simply commited to master and reset --hard it back. But I didn't expect it to forget it was a merge in the first place. After all, it does NOT touch the index nor the working tree, so why should it clear the MERGE_HEAD and MERGE_MSG?

So should this behaviour be changed?

Thanks, Jan

-- 
                                        - Jan Hudec <bulb@ucw.cz>
Next: Junio C Hamano
Message 1 of 4 in “[BUG?] git checkout -b removes MERGE_HEAD”
  1. Jan HudecNov 18, 2010
  2. Junio C HamanoNov 18, 2010
  3. Jan HudecNov 18, 2010
  4. Jeff KingNov 18, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.