git - git 可以告诉我 rebase 是否会在没有实际 rebase 的情况下发生冲突吗?

标签 git rebase

我想以编程方式确定如果我尝试对它们进行 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 --aborting it?

如果 rebase 成功完成,git rebase 命令返回成功(零)退出代码,否则返回失败(非零)退出代码。在 shell 脚本中,你可以只使用 git rebase $args || git rebase --abort.

关于git - git 可以告诉我 rebase 是否会在没有实际 rebase 的情况下发生冲突吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44953117/

相关文章:

windows - git-cola 不会在 Windows 上运行

git - 现在检查 git 中的远程分支是否安全?

Git 提交到 Dropbox 存储库问题

git - 如何追加不相关分支的提交?

git - 如何保护 GitHub 中的 "master"分支?

git - 选择要与 master merge 的提交

Git:为什么在 Re-basing 之后我的 fork 仍然落后于原始的 repo master?

git rebase 由于空格错误而失败

git - 为什么 'git bisect' 分支不知道?

git - lint-staged: 'git add' 命令的目的是什么