Last Updated: February 25, 2016
·
492
· Andrew565

See changes between commits in Git

Github has an awesome feature that allows you to see a visual diff log of all of the changes between two commits. Learned how to do it on the command line today.

Here's how to see the changes you've made in your repo between two commits (from the official Git docs):

git diff OLDER_COMMIT NEWER_COMMIT

Technically, you can use this to compare branches and tags too. Here's a handy shortcut for comparing your most recent commit with the commit right before it:

git diff HEAD^ HEAD

Especially handy if, like me, you forgot what you just finished working on (or, more likely, if you haven't worked on something for a couple days/weeks).