git pull時にerror: unable to resolve referenceのエラーが出た時の対処法

git pullを行うと以下のエラーが出ました。

# git pull
error: unable to resolve reference refs/remotes/origin/features/project/ganttchart: Not a directory
From https://github.com/aimluck/aipo
 ! [new branch]      features/project/ganttchart -> origin/features/project/ganttchart  (unable to update local ref)
error: some local refs could not be updated; try running
 'git remote prune origin' to remove any old, conflicting branches

コメントにあるように以下のコマンドを実行してみます。

# git remote prune origin

再びgit pullをしてみると直ったことがわかります。

# git pull
You are not currently on a branch, so I cannot use any
'branch.<branchname>.merge' in your configuration file.
Please specify which remote branch you want to use on the command
line and try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details.