我想以编程方式确定如果我尝试对它们进行 rebase ,我的功能分支会发生 rebase 冲突。有没有办法让 git 告诉我这些信息而无需实际执行 rebase?
否则,在 git rebase --abort
之前检测 rebase 是否失败的最简单方法是什么?
我的问题与这两个类似,它们是相同的,但用于 merge 而不是 rebase
最佳答案
Is there a way I can get git to tell me this information without actually performing the rebase?
简短的回答是“不”。长答案更长,但以“否”结尾:-) ...您可以通过编写大量代码来获得非常接近的答案,但要获得完整的正确答案,您必须执行 rebase 的所有提交复制步骤,在该步骤中点你也可以只运行 rebase。
Failing that, what is the simplest way to detect if a rebase failed before
git rebase --abort
ing it?
如果 rebase 成功完成,git rebase
命令返回成功(零)退出代码,否则返回失败(非零)退出代码。在 shell 脚本中,你可以只使用 git rebase $args || git rebase --abort
.
关于git - git 可以告诉我 rebase 是否会在没有实际 rebase 的情况下发生冲突吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44953117/