作为 Git (1.7.9.5) post-update
Hook 的一部分,我想(除其他外)删除在工作树中 checkout 的分支中的提交。这非常适合:
git rebase --onto $commit^ $commit $branch
但是,如果提交 $commit..$branch
中的更改建立在 $commit
中的更改之上,则删除可能会失败。在这种情况下,我不想让工作树处于用户必须干预的状态,而是大声失败。
我注意到,当 rebase 完全成功时,git rebase
返回退出代码 0,而如果遇到无法解决的 merge 冲突,则返回 1。
是否有一个选项我错过了向 git rebase
发出信号,表明它应该自动中止失败的 rebase,或者我是否需要使用 git rebase [...] || 之类的东西git rebase --abort
?
最佳答案
您需要||
(或同等内容)。
(我不会跳过自己的 rebase 中的提交,但我有一个 Python 脚本可以在获取后进行集体 rebase 。我使用非交互式 git rebase
的退出状态确定是否运行 git rebase --abort。)
关于git - 自动中止 "failed"git rebase?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32637504/