onlywei / explain-git-with-d3

Use D3 to visualize simple git branching operations.
MIT License
1.71k stars 390 forks source link

Show visually that HEAD points to a branch, not usually a commit #34

Open roryokane opened 9 years ago

roryokane commented 9 years ago

This would make the git checkout example clearer, when you git checkout bb92e0e like it suggests. Right now the only difference from git checkout master is the “Current Branch” text at the top left of the visualization, which is easily missed.

This would also make the git checkout -b example clearer. If you git checkout -b foo and git checkout -b bar, it looks like HEAD is just another branch, but colored green because it’s the most important.

It could look something like this:

Current Branch: master
  ╭────╮
--│    │
  ╰────╯
 bb92e0e…
 [master] ← [HEAD]
 [tested]
Current Branch: detached HEAD
  ╭────╮
--│    │
  ╰────╯ ↖︎
 bb92e0e… [HEAD]
 [master]
 [tested]