This happens to me when the branch I'm working in gets deleted from the repository, but the workspace I'm in is not updated. (We have a tool that lets you create multiple git "workspaces" from the same repository using simlinks.)
If git branch
does not mark any branch as current, try doing
git reset --hard <<some branch>>
I tried a number of approaches until I worked this one out.