Merge conflicts
Let's turn to the command line and do a pull as our branch has diverged from the origin. When we do, we're told that there is a merge conflict in Program.cs
and that the merge has failed. Git tells you to fix the conflicts and then commit the result. This is unusual, to get a merge conflict on a pull, but as you can see, it does happen. Let's handle this conflict and then set up a more typical situation:
Figure 4.16: A merge conflict
There are a few ways to handle any merge, but the easiest is to use a merge tool. I use KDiff3 (https://sourceforge.net/projects/kdiff3/). Since I use this a lot, I have put it into my config file:
git config --edit --global
Figure 4.17: Reviewing the configuration file
This sets up KDiff3 as my merge tool and tells Git where to find it. One of the things I like most about KDiff is that it will often fix the problem for you.
To invoke it, all I need to write is:
git mergetool
...