Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git difftool -d to view difference between two historic commits

I'm trying to do something which I think should be simple. I have two old commits in the log, X and Y (where X and Y are commit hashes). I want to see a visual, Directory representation of the differences between the two commits, so I run:

git difftool -d X Y

But this gives me a large number of differences which are not between the two commits.

If I create a brach b1 from X and a branch b2 from Y, then the command works as expected (git difftool -d b1 b2).

Can someone please explain my error in execution and thinking?

like image 601
Spacemoose Avatar asked Dec 11 '25 00:12

Spacemoose


1 Answers

As far as I'm aware, there should be no difference in behaviour whether you specify the commits by SHA-1 object name or by branch name (see SPECIFYING REVISIONS in the reference for gitrevisions), so this looks like it might be a bug.

Do you get the correct diff if you use git difftool instead of git difftool -d? How about if you use git diff? (All three should give the set of changes--just displayed differently.) Maybe also try using a different tool for actually carrying out the diff?

like image 114
Rich Avatar answered Dec 12 '25 12:12

Rich



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!