How can I diff against a revision of a single file using only the default Git GUI tools?
Posted
by Rich
on Stack Overflow
See other posts from Stack Overflow
or by Rich
Published on 2010-05-05T17:02:15Z
Indexed on
2010/05/05
18:08 UTC
Read the original article
Hit count: 263
I want to view the history of a single file, and then compare a single revision from that history against the current version.
On the command line, this is easy:
Run:
git log -- <filename>
Locate the version you want to compare,
Run:
git diff <commitid> -- <filename>
But how can this be done using only the default Git gui tools, git gui and gitk?
I know of two methods using gitk, but they're both horribly clunky:
Either:
Select the New View option from the View menu,
Type in the full path to your file into the box labelled Enter files and directories to include, one per line,
Locate the version you want to compare by looking at the highlighted items in the top pane, and click on it to select it,
Right-click on the current version and select Diff selected -> this,
Or:
Select Tree in the bottom right-hand pane,
Locate the file you want to look at, right-click on it, and select Highlight this only,
Locate the version you want to compare by looking at the highlighted items in the top pane, and click on it to select it,
Right-click on the current version and select Diff selected -> this,
Click on the file in the bottom right-hand pane to jump to it in the diff output, or scroll manually.
Is a better method than this?
© Stack Overflow or respective owner