Working Tree, Head, Index

Posted . Visible to the public.

"A single git repository can track an arbitrary number of branches, but your working tree is associated with just one of them (the "current" or "checked out" branch), and HEAD points to that branch."

My understanding is that a working tree is the dir and sub-dirs within it that contain the source files. It can be anywhere, but normally it is the same dir in which the hidden .git dir is located.

HEAD is the commit at the tip of the current branch. If you've just checked out the branch, i.e. have no modified files, then its content matches the working tree. As soon as you modify anything, it no longer matches.

The difference between HEAD (current branch or last committed state on current branch), index (aka. staging area) and working tree (the state of files in checkout) is described in "The Three States" section of the "3.1 Git Basics" chapter of Pro Git book by Scott Chacon (Creative Commons licensed).

kiatng
Last edit
Posted by kiatng to Git (2014-08-05 07:50)