As soon as you commit, HEAD
will point to the new commit you've made, which will have the tree contents of your index.
An excellent rundown of this all is available in Pro Git, in the Reset Demystified section
HEAD
is a symbolic ref-- that is, a ref that (usually) points to another ref. A branch is a type of ref, and your branch will be updated if you commit while that branch is checked out. However, you can check out things other than branches (tags, and plain commits by id), but then you'll have a "detached HEAD
". HEAD will still change when you commit, but you could lose those commits if you switch away.
In summary, the only thing you can guarantee updating when you commit is the symbolic ref HEAD
, and possibly your current branch, which is a ref
. All other data structures are created anew.