How can I say from a script if the “git cherry pick” fails?

If the pick cherry fails due to a merge conflict, it simply returns exit status 0.

Please do not tell me about --abort. I need to detect in a script if the original cherry pick command is not working.

Using git version 1.8.3.1 on CentOS 7.2.

EDIT: my script made cherry picks in if !, and I did not thenexit correctly in a non-zero output sentence . Sorry for the noise.

+4
source share
2 answers

$? contains the return code of the last process in bash.

$ ls /dev/null/foo
ls: /dev/null/foo: Not a directory
$ echo $?
1
+4
source

git status "1 " "".

0

Source: https://habr.com/ru/post/1659616/


All Articles