I ended up with a detached head today, the same problem as described in this question:
"git push says everything up-to-date even though I have local changes"
As far as I know I didn't do anything out of the ordinary, just commits and pushes from my local repo.
So how did I end up with a detached head?