Handle detached head states for git repositories in dynamic prompt.