2 ms·
Git can show you the diff of any commit as well, though I guess maybe the interactivity you mentioned is important. Anyhow, with just git. Diff of most recent
by codetrotter 8y ago
Git can show you the diff of any commit as well, though I guess maybe the interactivity you mentioned is important.
Anyhow, with just git.
Diff of most recent commit:
git show HEAD
Diff of preceding commit:
git show HEAD^
Diff of commit before that again
git show HEAD^^
Of course you don’t want to type ^ 200 times. Fortunately you don’t have to. Diff of commit three steps back before most recent:
git show HEAD~3
Or you can look at the log first
git log
And find a specific commit and then use the first few characters of the id of that commit, e.g.
git show af4c
And of course I would be remiss to not mention
git diff
And
git diff --cached
These two show you unstaged and staged changes before you commit. I use these commands all the time. So much that they are two of the commands I have created very short two-letter aliases for in my .bashrc
alias di="git diff --cached"
alias dp="git diff"