前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >git pull fails “unable to resolve reference” “unable to update local ref”

git pull fails “unable to resolve reference” “unable to update local ref”

作者头像
Ryan-Miao
发布2018-03-14 10:36:50
8230
发布2018-03-14 10:36:50
举报
文章被收录于专栏:Ryan MiaoRyan Miao

问题

由于有人rebase了分支,或者不知道怎么搞的。其他人拉取代码的时候,发现拉不下来。

代码语言:javascript
复制
>git fetch

error: cannot lock ref 'refs/remotes/origin/xxx-branch': is at 8117caf7b1c88b2d5dfebd7581f6891d87b9abee but expected f38e8d35ae8ea7f177c537a98f4140dd76b8e2bd
From xxxxxxx-git-url
 ! f38e8d35..9d7b8e7a  xxx-branch -> origin/xxx-branch  (unable to update local ref)

解决方案

尝试clean本地git

代码语言:javascript
复制
$ git gc --prune=now
$ git remote prune origin

man git-gc(1):

git-gc - Cleanup unnecessary files and optimize the local repository git gc [--aggressive] [--auto] [--quiet] [--prune= | --no-prune]

代码语言:javascript
复制
 Runs a number of housekeeping tasks within the current >repository, such as compressing file revisions
  (to reduce disk space and increase performance) and removing unreachable objects which may have been
  created from prior invocations of git add.

  Users are encouraged to run this task on a regular basis within each repository to maintain good disk
  space utilization and good operating performance.

man git-remote(1):

git-remote - manage set of tracked repositories git remote prune [-n | --dry-run]

代码语言:javascript
复制
Deletes all stale remote-tracking branches under <name>. These stale branches have already been
      removed from the remote repository referenced by <name>, but are still locally available in
      "remotes/<name>". 

来源

Stack Overflow , 原问题:https://stackoverflow.com/questions/2998832/git-pull-fails-unable-to-resolve-reference-unable-to-update-local-ref

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 问题
  • 解决方案
  • 来源
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档