git pull fails “unable to resolve reference” “unable to update local ref”
问题
由于有人rebase了分支,或者不知道怎么搞的。其他人拉取代码的时候,发现拉不下来。
1 | >git fetch |
解决方案
尝试clean本地git
1 | $ git gc --prune=now |
man git-gc(1):
git-gc - Cleanup unnecessary files and optimize the local repository
git gc [–aggressive] [–auto] [–quiet] [–prune=
| –no-prune] 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]
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
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Ryan Miao的博客!
评论