Reputation: 267010
I have tried:
git diff sha1 sha2
But the output isn't the best, is it possible to see the difference between 2 commits using gitk?
Upvotes: 52
Views: 25836
Reputation: 19487
No, but you can do it using meld:
git checkout sha1
git reset sha2
git diftool --tool=meld
The trick is, by checking out sha1 and then resetting to sha2, you are making all the differences between them appear to be uncommitted changes. Then meld can use its ability to view uncommited changes, to do a diff of all the files involved at the same time.
Upvotes: 2
Reputation: 81907
Not sure if you actually want a diff or if you want the normal gitk representation but only for the commits leading from sha1
to sha2
In the later case you can provide all the normal revision parameters: https://www.kernel.org/pub/software/scm/git/docs/gitrevisions.html
So you can do things like
gitk sha1..sha2
or if master got merged into the sha2
branch and you don't want to see the commits that come from master and sha1
, is the first commit branched from master
use
gitk master..sha2
Upvotes: 9
Reputation: 47032
Unfortunately, gitk
doesn't support diff output in that way. :-( You can use git difftool
though. It comes with support for a number of tools builtin. For instance, you could do git difftool -t kdiff3 sha1 sha2
. It shows the file diffs one at a time. There was talk on the git list about supporting more than just one file at a time via a diff tool, but I'm not sure where that ended up. I haven't seen a patch implementing it yet.
Upvotes: 3