繁体   English   中英

由于文件已删除,Git无法从原点拉出

[英]Git can't pull from origin because of deleted file

我尝试从源中提取更新本地git存储库,并得到了熟悉的消息:

error: Your local changes to the following files would be overwritten by merge:
    <list of files>
Please, commit your changes or stash them before you can merge.
Aborting

好吧,没什么大不了的。 我藏了零钱,然后再次拉...并得到了完全相同的消息。 好吧,那有点奇怪。

因此,我尝试添加和提交文件...出于同样的原因,它仍然无法拉出。

出于沮丧,我删除了有问题的文件。 现在我仍然遇到相同的错误,但是该文件甚至不存在了。

我不完全确定如何获取它来停止跟踪不存在的文件...而且我不确定为什么不能从源中提取文件。

git状态显示:

# On branch master
# Your branch is behind 'origin/master' by 249 commits, and can be fast-forwarded.
#
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   <list of files>
#
no changes added to commit (use "git add" and/or "git commit -a")

有什么建议么?

假设您处于没有任何未提交的更改的状态,

git reset --hard HEAD

然后从存储库的根目录开始

git clean -dfx 

然后重试,如果它不起作用,则发布部分错误和git status的输出

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM