Git/Github:错误:您对以下文件的本地更改将被合并覆盖:README.md a_text_file.txt不存在 [英] Git/Github: error: Your local changes to the following files would be overwritten by merge: README.md a_text_file.txt DONT EXIST

查看:47
本文介绍了Git/Github:错误:您对以下文件的本地更改将被合并覆盖:README.md a_text_file.txt不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图从Github中的远程仓库中拉到我的文件夹.我希望能够在我将其包含在我的IDE中时将其推入和推入.

I am trying to pull from a remote repo in Github to my folder. I want to be able to pull and push changes as I have them in my IDE.

每次我尝试从设置为远程 origin 的存储库中提取时,都会出现以下错误:

Everytime I try and pull from the repo which I have set up as remote origin I get the following error:

error: Your local changes to the following files would be overwritten by merge:
 README.md a_text_file.txt

我完全不理解这一点,因为此 a_text_file.txt 不在链接的目录中,也不在我的存储库中,但是直到解决此问题后,我才能拉动.

I don't understand this at all as this a_text_file.txt is not in my directory that is linked, nor is it in my repo, yet I cannot pull until this is resolved.

我尝试取消链接并将远程链接重新链接到仓库,但错误仍然存​​在.

I have tried to unlink and relink the remote to the repo but still the error persists.

任何人都可以解释这是怎么回事吗?

Can anyone explain what's going on here?

谢谢

推荐答案

当您尝试对某些目标进行 checkout 时,它将把目标的内容放置在磁盘上.如果您在磁盘上进行了更改,则 checkout (默认情况下)将拒绝覆盖您所做的任何更改,并给您带来checkout冲突:

When you try to checkout some target, it will place the contents of the target on-disk. If you have made changes on-disk, then checkout will (by default) refuse to overwrite any changes that you have made and will give you a checkout conflict:

error: The following untracked working tree files would be overwritten by checkout:
    file_one
    file_two
Please move or remove them before you switch branches.
Aborting

请注意,每个冲突的文件都是单独标识的,每行一个.

Note that each file that is in conflict is identified individually, one per line.

在您的 案例中,您有一个冲突报告为:

In your case, you have a conflict reported as:

README.md a_text_file.txt

在这种情况下,这不是两个文件,而是一个文件.您最终以某种方式在工作文件夹中得到一个名为 README.md a_text_file.txt 的文件.当我用手指指着vi命令或Shell重定向时,这会定期发生在我身上.也许当我写一个脚本时,空白是一个分隔符,但有时(例如bash),并且它最终将路径列表视为单个字符串而不是数组.

In this case, this is not two files, but a single file. Somehow you have ended up with a file named README.md a_text_file.txt in your working folder. This happens to me periodically when I fat-finger a vi command or a shell redirection. Or possibly when I write a script where whitespace is a delimiter, but only sometimes (like bash) and it ends up treating a list of paths as a single string instead of an array.

这篇关于Git/Github:错误:您对以下文件的本地更改将被合并覆盖:README.md a_text_file.txt不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆