git:樱桃挑选的不同输出

时间:2015-06-26 02:47:42

标签: git git-cherry-pick

我正在尝试编写一个自动执行git cherry-pick的脚本。我需要能够处理git cherry-pick的所有可能的失败。到目前为止,我已经计算了3种输出:

+ Cherry-pick成功,没有合并冲突。退出代码为0.输出如下所示:

git cp ed54dfc
[dev/nango/cp3_nocconflict 97f2dce] test cp1
1 file changed, 1 insertion(+)
create mode 100644 foo.txt
已经在分支中的

+ Cherry-pick提交,或者没有提交代码。退出代码1.输出如下所示:

You are currently cherry-picking commit 61ff477.


It took 3.90 seconds to enumerate untracked files. 'status -uno'
may speed it up, but you have to be careful not to forget to add
new files yourself (see 'git help status').
nothing to commit, working directory clean
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:

git commit --allow-empty

Otherwise, please use 'git reset'

+ Cherry-pick引发合并冲突。退出代码1:

error: could not apply ed54dfc... test cp1
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'

还有其他樱桃选择的可能吗?我看一下这个文档,并没有太多提及樱桃选择的可能结果。

感谢。

1 个答案:

答案 0 :(得分:1)