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

Re: Interpreting git merge failures

From
Jeff King <peff@peff.net>
Date
Jul 12, 2011, 06:33 UTC
Message-ID
<20110712063300.GB12491@sigill.intra.peff.net>
In-Reply-To
<CAKmUPx5Qt2K+7F+BsW3WTmRjodBSrteuyG8p9oRHZuhApTu4+g@mail.gmail.com>
On Thu, Jul 07, 2011 at 11:45:57AM -0700, Scott Bronson wrote:
Show 6 quoted lines
> What is the best way to determine why a git merge failed?
> I'm writing a script that needs to do different things depending
> on what went wrong.
> 
> Right now I'm parsing error messages.  It's obviously a bad
> idea and prone to breakage but it does work.   Example:
Sorry, that's the best you can do with "git merge" currently.

The usual advice would be to check the repo status yourself with plumbing tools, but:

  1. That's a lot of work on the part of a script writer.
  2. It's not atomic. You want to know why a merge failed, but
     circumstances might have changed since the original failure.

It would be nice if "git merge" gave different exit codes for various situations. I don't think it would be all that big a change, and you might be a good person to suggest which conditions need their own exit code, as you are also writing the consuming end of the codes.

Want to write a patch?
-Peff
Previous: Scott BronsonNext: Junio C Hamano
Message 2 of 3 in “Interpreting git merge failures”
  1. Scott BronsonJul 7, 2011
  2. Jeff KingJul 12, 2011
  3. Junio C HamanoJul 12, 2011

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.