Do I understand what's detached HEAD is all about in GIT? I see it as follows.
HEAD points to the currently active branch. If I checkout
(select) an earlier commit in the branch, HEAD's will store the hash of that commit (instead of branch name) - this is the situation called 'detached HEAD'. Now suppose I added a few commits after doing that and checkout
back the master
branch (that's where I was at the beginning).
Now, what's the exact reason I've lost the commits I'd just made? Is it because the commits only know its parents, not children? The solution is to create a new branch in detached HEAD state before doing commits, right? This way I'll be able to reference to the new commits made from that point.
Interesting source