1. 13
  1.  

  2. 4

    This is quite spectacular, thanks! Extra bonus points for a working history in the command line and nice hints, like ‘enter a branch name …’

    1. 1

      The diagram doesn’t show one interesting thing about Git: HEAD usually refers to a branch, not to a commit. This is transparent in most cases, because Git usually just follows that branch’s pointer to get to the commit. But Git uses this when you create a new commit with git commit. It only updates the branch that HEAD points to to point to the new commit – it doesn’t update all branches that happened to be on the old commit.

      The visualization could explain this aspect of Git’s model if the git checkout example displayed a normal HEAD and a detached HEAD like this:

        /''''\
      --|    |
        \____/
       bb92e0e…
       [master] ← [HEAD]
       [tested]
      
        /''''\
      --|    |
        \____/ ↖︎
       bb92e0e… [HEAD]
       [master]
       [tested]