I ended up with a detached head today, the same problem as described in: git push says everything up-to-date even though I have local changes
As far as I know I didn
It can happen if you have a tag named same as a branch.
Example: if "release/0.1" is tag name, then
git checkout release/0.1
produces detached HEAD at "release/0.1". If you expect release/0.1 to be a branch name, then you get confused.