Analysis
If you are running git under a file system that is not case sensitive (Windows or OS X) this will occur if there are two branches with the same name but different capitalisation
Solution
A
- Delete the wrong remote branch (you shouldn’t have branches that differ only by case)
git push origin -- delete branch-name
- and then
git remote prune origin
and everything should work
B
- 查看引用
git show-ref |grep branch-name
- 删除本地 ref (对远端不会有影响)
git update-ref -d refs/remotes/origin/branch-name
Related
查看分支详情
git log –source |grep branch-nameGit 清理无效的远程追踪分支
- 查看信息
git branch –a 用来查看所有的分支,包括本地和远程的。
分支在远程其实早就被删除了,但是在本地依然可以看见。
查看有关于origin的一些信息,包括分支是否tracking。
git remote show origin远程版本库上删除了某一分支,假如远程版本库名是 origin,则使用如下命令先查看哪些分支需要清理:
git remote prune origin –dry-run- 然后执行
git remote prune origin
刷新本地仓库与远程仓库的保持这些改动的同步,完成了无效的远程追踪分支的清理工作。
无效的远程追踪分支会以gone来标识
- 查看信息