git - Git 如何决定冲突?

标签 git merge-conflict-resolution

当团队中的其他人修改了某个文件时,当我从 GitHub pull 时,Git 命令显示存在 Git 无法修复的 Unresolved 冲突。我打开 Perforce 或 Visual Studio 2012 来修复冲突,图形工具显示没有冲突并快速执行 merge 。

Git 是否有独立于您设置的 mergetool/difftool 的内部冲突检测/merge 工具?

或者它是否使用您配置的工具来自动 merge 和检测无法解决的冲突?

我的情况很奇怪,Git 显示它无法自动 merge ,但图形工具没有显示任何问题。

最佳答案

Git 有一个独立于 difftool 的内部 merge 系统。无论如何,您可以使用手册中的 -s 选项指定 merge strategy:

-s <strategy>
--strategy=<strategy>

Use the given merge strategy; can be supplied more than once to specify them in the order they should be tried. If there is no -s option, a built-in list of strategies is used instead (git merge-recursive when merging a single head, git merge-octopus otherwise).

在 merge 大量树时,策略从简单的 FastForwardOctopus。 检查这个answer查看不同的 merge 策略是如何工作的。

无论如何,你的场景很奇怪。也许您的 IDE 使用不同的 merge 策略,所以当它打开时,它会以正确的方式进行 merge 。

关于git - Git 如何决定冲突?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17656448/

相关文章:

git - 为什么 'git commit' 不保存我的更改?

git - Trac 1.0 无法浏览 Git 存储库的源代码

git - Chef : How to add changes made via dashboard to Git?

git - 当有人从我的 git 提交中挑选并提交了他们自己的提交时,我该如何 merge ?

Git merge 冲突在我没有的文件上?

git am 失败后 git 状态和 git diff 为空

Xcode merge 两个分支Git

xcode - 由于与 UserInterfaceState.xcuserstate 冲突而无法合并

git - 工作目录和本地存储库有什么区别?

git - 没有 .git 文件上传到 Git 存储库