The differencer in git gui / gitk is usually good enough for me, but occasionally
a commit diff can be really confusing, in which case
git difftool
will start up a graphical differ.
Note that the syntax for looking at the last commit, which is often what you want not least because git gui won't show that, is:
git difftool HEAD~1
(Here's a nice explanation of what the ~ and ^ mean http://www.paulboxley.com/blog/2011/06/git-caret-and-tilde)
With python xxdiff can get confused by indentation changes. If this happens go to Options and tell it to ignore whitespace.
That
makes the comparison work better, (although at that point it won't
highlight the whitespace changes, but you can still see them).
-----------------------
Other diff tools
For me the graphical differ is always xxdiff, which I love, because it's fast and does the business.
That appears to be set in my git config, which I can look at with:
git config -l
the relevant line is:
merge.tool=xxdiff
Sometimes, a commit can be particularly confusing, at which point I feel the need to try out different diff tools.
This is a pointless but fun merry-go round, I always end up going back to xxdiff.
However, this is how to do it.
Install them all:
sudo apt install colordiff wdiff kompare meld kdiff3 xxdiff diffuse tkdiff
Try them out:
git difftool --extcmd=kdiff3 HEAD~1 #shows whitespace by default, isn't confused by it
git difftool --extcmd=xxdiff HEAD~1
git difftool --extcmd=diffuse HEAD~1 #shows whitespace by default, isn't confused by it, syntax colouring! This would be the best one, except that the very syntax colouring makes it hard to see what's going on
git difftool --extcmd=meld HEAD~1 #really beautiful, has same whitespace problems as xxdiff, and solution is the same, but it's a persistent preference which I don't like (state!!)
git difftool --extcmd=colordiff HEAD~1 # same as git diff HEAD~1
git difftool --extcmd=tkdiff HEAD~1 #noisy display, hard to read
git difftool --extcmd=diff HEAD~1 # like git diff HEAD^, but no colours
git difftool --extcmd=wdiff HEAD~1 # no colours, can't work out what it's doing
Saturday, February 15, 2020
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment