#Merging with graphical diff tools
First things first
It's worth trying to just run
git difftool or
git mergetool as by default most Git installations will configure your OS's diff tool (Meld for Ubuntu, and FileMerge / Opendiff for OSX).
There are two ways of updating the merge tools that Git will use by default. The first is to copy the config straight into your
.gitconfig file (usually in your home folder). If you're not happy doing that you can use
git config, e.g.:
git config --global diff.tool diffmerge git config --global diffmerge.cmd "diffmerge --merge --result=\"$MERGED\" \"$LOCAL\" \"$(if test -f \"$BASE\"; then echo \"$BASE\"; else echo \"$LOCAL\"; fi)\" \"$REMOTE\""
You'll end up with the same thing whichever way you do it (can also review this with
git config -l) so it's a case of personal preference.
This isn't free, but it is really nice.
[merge] tool = diffmerge [mergetool "diffmerge"] cmd = "diffmerge --merge --result=\"$MERGED\" \"$LOCAL\" \"$(if test -f \"$BASE\"; then echo \"$BASE\"; else echo \"$LOCAL\"; fi)\" \"$REMOTE\"" trustExitCode = true [diff] tool = diffmerge [difftool "diffmerge"] cmd = diffmerge \"$LOCAL\" \"$REMOTE\" [merge]
(NB: The 'cmd' option might not be needed as Git bash already have this configured. Try without it to start with and add it in if you get errors).
Not as pretty as Diffmerge but it is open source, therefore free, which will appeal to a lot of people. Along with Diffmerge you can install this with
apt-get install (OSX may be able to use Homebrew, otherwise you'll have to download the binary from the website
Config looks like this:
[diff] tool = kdiff3 [merge] tool = kdiff3
('cmd' argument isn't needed as Git knows how to handle KDiff3).
By default OSX will use
filemerge. Ubuntu will use
meld. Both are ok, but not very easy to use, particularly when merging as they won't automatically try to merge conflicts (so it's easy to lose changes without realising)
Diffmerge is the prettiest, but for set up KDiff3 is much more straightfward.
Also, you can do :
git difftool -d to do a 'dir-diff' (open one window with all the changes in a tree structure)
git difftool file_name to just open one specific file. This should also work with