git - 如何检查两个分支的 merge 冲突,而不 merge 它们?

标签 git

由于我们项目的一个发布步骤,我无法 merge 两个分支,但我想知道它们之间是否存在 merge 冲突。我该怎么做?

最佳答案

假设您在 master 分支上,您想要测试 dev 分支是否可以在不冲突的情况下 merge 到 master 中。

# In the master branch
git merge dev --no-ff --no-commit

之后,您将能够知道是否存在冲突。

要在正常情况下返回,只需中止 merge :

git merge --abort

根据 git 文档:

--ff
Do not generate a merge commit if the merge resolved as a fast-forward, only update the branch pointer. This is the default behavior.

-no-ff
Generate a merge commit even if the merge resolved as a fast-forward.

--commit
Perform the merge and commit the result. This option can be used to override --no-commit.

--no-commit
With --no-commit perform the merge but pretend the merge failed and do not autocommit, to give the user a chance to inspect and further tweak the merge result before committing.

关于git - 如何检查两个分支的 merge 冲突,而不 merge 它们?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10879331/

相关文章:

Eclipse git 无法完成 rebase

Git 从存储库、Github 和提交者中删除文件

git - merge 两个fork,成为git新的master

git - Git 可以从远程存储库的远程跟踪分支中获取吗?

ruby-on-rails - 无法在 Windows 10 中删除 Ubuntu 中的文件夹

git - 如何避免将 'eval' 与 'git-for-each-ref' 结合使用?

Git:如何确定是否存在对提交的引用

git - 为什么 git shallow clone 可以比 <depth> 有更多的提交?

java - 我是否需要指定分支来列出 JGit 中两个修订版之间的提交?

git clone 以 Broken Pipe 结束