How does Git decide on conflicts?

Tamim Al Manaseer picture Tamim Al Manaseer · Jul 15, 2013 · Viewed 8.7k times · Source

When I pull from GitHub when someone else on the team modified a certain file, Git command shows that there are Unresolved Conflicts that Git couldn't fix. I open Perforce or Visual Studio 2012 to fix the conflicts and the graphical tools shows me there are no conflicts and performs the merge quickly.

Does Git have an internal conflict detection/merge tool that is independent of your set mergetool/difftool?

Or does it use your configured tools to auto merge and detect unresolvable conflict?

My scenario is weird, Git shows that it can't automerge but the graphical tools show no issues.

Answer

Atropo picture Atropo · Jul 15, 2013

Git has an internal merge system that is independent of difftool. Anyway you can specify the merge strategy using the -s option, from the manual:

-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).

Strategies go from the simple FastForward to the Octopus when merging a lot of trees. Check this answer to see how the different merge strategies work.

Anyway your scenario is weird. Maybe your IDE is using a different merge strategy, so when it opens it does the merge the right way.