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

Re: How can I tell, from a script, if “git cherry-pick” fails?

From
Pranit Bauva <pranit.bauva@gmail.com>
Date
Nov 2, 2016, 15:36 UTC
Message-ID
<CAFZEwPP1XyE+X6ipes4JNsUz3JVS+ErbLfQ-zYXZ3KA75bho5Q@mail.gmail.com>
In-Reply-To
<CAGSZTjKg1=tMYgFiwys=ePVT+3p6KTa1mQ0fP9pPns-Nvd+6fA@mail.gmail.com>
Hey Kevin,
On Wed, Nov 2, 2016 at 8:44 PM, Kevin Layer <layer@known.net> wrote:
> If the cherry-pick fails due to a merge conflict, it just returns an
> exit status of 0.  I have a script that does a series of cherry-picks
> and I need to know if they succeed.

Well, I haven't checked what it returns in git 2.10, but you can always redirect the stdout and stderr to the output and grep for the text which it shows in the actual output. Here[1] is an example of how to do it.

[1]: https://github.com/git/git/blob/master/t/t3507-cherry-pick-conflict.sh#L42-L55

Regards, Pranit Bauva

Previous: Kevin Layer
Message 3 of 3 in “How can I tell, from a script, if “git cherry-pick” fails?”
  1. Kevin LayerNov 2, 2016
  2. Kevin LayerNov 2, 2016
  3. Pranit BauvaNov 2, 2016

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.