Detached head Submodule
If you're on (no branch), you can create a new branch out of it by doing so:
git checkout -b save_my_work
now you should be on branch "save_my_work" with all your commits saved.
Now go back to master:
git checkout master
and merge your branch "save_my_work":
git merge save_my_work
Verify that all your commits are there by doing "git log".
You can now delete your "save_my_work" branch as you shouldn't need it:
git branch -D save_my_work
HTH