Detached HEAD

HEAD usually follows a branch. But it can also point straight at a commit, with no branch involved — that is a "detached" HEAD.

It sounds alarming and is not. It just means "I am looking at this exact commit." You can look around freely; the danger is only that commits made here belong to no branch, so they are easy to lose track of.

Every commit has an id — printed inside its circle — and you can check one out directly.

Exercises

  1. Exercise 1. Check out the first commit directly, by its id, to look around without being on any branch.
  2. Exercise 2. You are already detached at c0. Commit here and watch what happens: the new commit exists, but no branch points at it.