Fix detached HEAD not showing in tree 

Fixes: https://github.com/rowanj/gitx/issues/189.

To avoid file conflicts, based on previous pull request.