Configure diffmerge with git

Use the following to configure git to use diffmerge for diffing and merging files:

git config --global diff.tool diffmerge
git config --global difftool.diffmerge.cmd "diffmerge "$LOCAL" "$REMOTE""

git config --global merge.tool diffmerge
git config --global mergetool.diffmerge.cmd "diffmerge --merge --result="$MERGED" 
  "$LOCAL" "$BASE" "$REMOTE""
git config --global mergetool.diffmerge.trustexitcode false

The following will show diffmerge with the two versions of myfile.java side by side:

git difftool master~2 myfile.java
blog comments powered by Disqus