Compare commits in Git revision log
Answered
The revision log is a really, really nice tool, particularly with the branch graph. But I'm wondering if there's any way to compare two arbitrary commits in that view. I know I can use the Git ⇒ Show History view to compare between commits on a particular branch, or between current HEAD and some other branch HEAD, but it would be really nice to be able to diff against non-HEAD commits.
Thanks,
Derek
Please sign in to leave a comment.
Hi Derek,
If you select all commits between the given two, the tree view at the right of the commit list will show the compound difference of all these selected commits, which probably is equal to what you want: the difference between two given revisions.
I tried and I see what you mean, but that's not quite the same. If I have multiple branches and need to see the difference between, say, HEAD on one and ~1 on the other. I can't avoid showing the changes on other branches that chronologically have commits between them.
Thanks,
Derek
You're right, that won't work in this case.
Could you please fire a feature request into our bugtracker?
Meanwhile other workarounds for certain cases could be:
* set up filter only for the given branch and use the method described above;
* use compare with branch (if you need to compare the HEAD with another branch head).
Uh, 5 years have passed. Didn't anyone submit the request?
Seems there is https://youtrack.jetbrains.com/issue/IDEA-86480
BTW, comparing 2 commits with each other works in the History view - so if you call SHow History on a file or folder, you'll be able to select 2 commits and compare
IDEA-86480 doesn't mention Git Log, so it's only (closely) related to this topic.
Comparing two commits from the Git history view for the whole project seems to be a nice workaround, thank you. However, this makes me wonder why the user experience is different between these two views. They both rely on the git commit tree and seem similar, then why do they coexist?
> doesn't mention Git Log, so it's only (closely) related to this topic.
It speaks about selecting commits in git, so I believe it is exactly about Log, as it is the main place to browse commits.
> They both rely on the git commit tree and seem similar, then why do they coexist?
They solve different use-cases of working with history. Indeed, some actions could be unified. Like the mentioned one with commits comparison.
If you have any specific issue, please report to https://youtrack.jetbrains.com/issues/IDEA