git pull error: remote ref is at but expected

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

  1. Delete the wrong remote branch (you shouldn’t have branches that differ only by case)
git push origin -- delete branch-name
  1. and then
git remote prune origin 

and everything should work

B

  1. 查看引用
git show-ref |grep branch-name
  1. 删除本地 ref (对远端不会有影响)
git update-ref -d refs/remotes/origin/branch-name

  • 查看分支详情
    git log –source |grep branch-name

  • Git 清理无效的远程追踪分支

    1. 查看信息
      git branch –a 用来查看所有的分支,包括本地和远程的。
      分支在远程其实早就被删除了,但是在本地依然可以看见。

    查看有关于origin的一些信息,包括分支是否tracking。
    git remote show origin

    远程版本库上删除了某一分支,假如远程版本库名是 origin,则使用如下命令先查看哪些分支需要清理:
    git remote prune origin –dry-run

    1. 然后执行
      git remote prune origin
      刷新本地仓库与远程仓库的保持这些改动的同步,完成了无效的远程追踪分支的清理工作。

    无效的远程追踪分支会以gone来标识

Reference

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值