If the cherry-pick fails due to a merge conflict, it just returns an exit status of 0.
Please don't tell me about --abort
. I need to detect, in a script, if the original cherry-pick command fails.
Using git version 1.8.3.1 on CentOS 7.2.
EDIT: my script was doing the cherry-pick in an if !
and I didn't exit properly in the then
clause with a non-zero exit. Sorry for the noise.
$?
holds the return code of the last process run in bash.
$ ls /dev/null/foo
ls: /dev/null/foo: Not a directory
$ echo $?
1
You can call git status
or equivalent and inspect its output for a normal "1 ahead of tracking" status or a "merge" status.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With