To see the diff for a particular COMMIT hash, where COMMIT is the hash of the commit:
git diff COMMIT~ COMMIT will show you the difference between that COMMIT's ancestor and the COMMIT. See the man pages for git diff for details about the command and gitrevisions about the ~ notation and its friends.
Alternatively, git show COMMIT will do something very similar. (The commit's data, including its diff - but not for merge commits.) See the git show manpage.
(also git diff COMMIT will show you the difference between that COMMIT and the head.)
To see the diff for a particular COMMIT hash, where COMMIT is the hash of the commit:
git diff COMMIT~ COMMIT will show you the difference between that COMMIT's ancestor and the COMMIT. See the man pages for git diff for details about the command and gitrevisions about the ~ notation and its friends.
Alternatively, git show COMMIT will do something very similar. (The commit's data, including its diff - but not for merge commits.) See the git show manpage.
(also git diff COMMIT will show you the difference between that COMMIT and the head.)
As mentioned in "Shorthand for diff of git commit with its parent?", you can also use git diff with:
git diff COMMIT^!
or
git diff-tree -p COMMIT
With git show, you would need (in order to focus on diff alone) to do:
git show --color --pretty=format:%b COMMIT
The COMMIT parameter is a commit-ish:
A commit object or an object that can be recursively dereferenced to a commit object. The following are all commit-ishes: a commit object, a tag object that points to a commit object, a tag object that points to a tag object that points to a commit object, etc.
See gitrevision "SPECIFYING REVISIONS" to reference a commit-ish.
See also "What does tree-ish mean in Git?".
Can I see all of my changes before I push them and open a PR?
Newbie question: how do I view the contents of a file already commited?
How to see changes in git commits, before pushing them | Drupal.org
See changes in different git commits
Videos
I'm pretty new to git and I got the basic workflow down. Now I'm trying to improve my skills a bit with git.
Is there some easy way for me to review all of my changes before I push to a remote branch and open a PR?
It would be nice to make sure I didn't forget to remove any unnecessary comments and code. The main thing I could do is simply open the PR and check on Github "files changed" and review it there and do another commit and push if I need to clean things up.
But I'm not sure if there's a way to do this before the PR is even opened. I'm using Android Studio btw so if there's a way in Android Studio (which is basically IntelliJ) then that would be good.
I don't want to see the changes, just how the file exists in the commited state. I know I can check out the commit and see it, but is there a way to do so without the checkout? Probably a stupid newbie question, thanks for the help.