由于我们项目的一个发布步骤,我无法 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/