Hacker News new | ask | show | jobs
by jcoffland 2703 days ago
Really well written. The other articles in the series on computer graphics are excellent too. The use of GitHub to show diffs of each step is quite effective.
1 comments

> The use of GitHub to show diffs of each step is quite effective.

Little off-topic, but that's one of the reasons I like to use Magit on Emacs, you can see the diff of each commit interactively and intuitively.

[1]:https://magit.vc/

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"
Alternatively, you can use `tig` which allows you to browse the commit log, diffs, and blames interactively. It's a terminal ui tool.
I’m a noob on a new team with git (well versed on TFS though) thank you for posting this.