There are some areas in Git that are so unusable that it baffles me. Merging is one. I tried, but Git really took unusability to new heights here. I recommend trying to do a merge with Git to entertain yourself one day. Just don’t expect to come out of it with a merged file. I think they included merging as a practical joke.
But Git DOES have hooks that let you use other tools! I played with some of them, and for me Perforce won hands down. Perforce is another source control system, but unlike Git, Perforce likes you. And they made some of their tools free!
So download and install them!
http://www.perforce.com/product/components/perforce-visual-merge-and-diff-tools
Then you just need to wire Git up to use Perforce for merge and diff. To do that, run these git config commands:
git config --global merge.tool p4merge
git config --global mergetool.p4merge.path /Applications/p4merge.app/Contents/Resources/launchp4merge
git config --global mergetool.p4merge.trustExitCode false
git config --global mergetool.keepBackup false
git config --global diff.tool p4merge
git config --global difftool.p4merge.path /Applications/p4merge.app/Contents/Resources/launchp4merge
git config --global difftool.p4merge.trustExitCode fals
Those make changes to your ~/.gitconfig file – so if you edit that file, you should see these sections:
[mergetool "p4merge"]
trustExitCode = false
path = /Applications/p4merge.app/Contents/Resources/launchp4merge
[difftool "p4merge"]
trustExitCode = false
path = /Applications/p4merge.app/Contents/Resources/launchp4merge
[merge]
tool = p4merge
[diff]
tool = p4merge
[mergetool]
keepBackup = false
Then when you need to merge files just type the following:
git mergetool
and you’ll get Perforce’s merge tool instead of Git’s merge!
The Perforce download page has a video on how to use their tools. In essence the top has three columns, the original file, the file with your changes, and the file with the other changes you’re trying to merge in. The bottom has all the changes merged using P4’s best guess. Just look for the button at the top to go to the next conflict, and edit the code at the bottom to be as desired. Then save, and close the Perforce editor to go to the next conflict!
Want to know what the settings in the configuration file mean and what else you can configure? Look here:
https://git-scm.com/docs/git-mergetool