[英]git pull issue with untracked files
This is my scenario. 这是我的情况。
I realised I had a filename in the wrong case on my server. 我意识到我的服务器上的文件名有误。 So I changed the filename to the right case and it fixed the problem.
因此,我将文件名更改为正确的大小写,从而解决了该问题。
On my local machine, I renamed the file in Git and pushed the change. 在本地计算机上,我在Git中重命名了文件并推送了更改。
Back on my server, I have run git pull
and now it's saying: 回到我的服务器上,我运行了
git pull
,现在说:
The following untracked working tree files would be overwritten by merge
以下未跟踪的工作树文件将被合并覆盖
Please move or remove them before you can merge
请先移动或删除它们,然后再进行合并
And it lists the file I renamed. 它列出了我重命名的文件。 I can understand why it's doing this, but I am happy for it to overwrite the file.
我可以理解为什么这样做,但是我很高兴它能覆盖文件。
What do I need to run so I can finish my git pull
? 我需要运行什么才能完成
git pull
?
Thanks 谢谢
What can I do so the git pull 我该怎么办git pull
To summate what happened: 总结发生了什么:
mv somename someName
on the server (which is essentially another local repo) mv somename someName
之类的操作(本质上是另一个本地存储库) This caused git to see that somename
was deleted and also found that someName
was a new untracked file. 这导致git看到
somename
被删除,并且还发现someName
是一个新的未跟踪文件。
git mv somename someName
on your local repo git mv somename someName
上执行了git mv somename someName
Git correctly tracks this as a file rename and handles it appropriately. Git会正确地将此作为文件重命名进行跟踪并适当地处理它。 Other repos pulling this change would rename the file in question appropriately with no issues.
其他执行此更改的存储库将适当地重命名有问题的文件,没有问题。
git commit
and git push
from your local repo to remote git commit
和git push
从本地仓库到远程 git pull
onto your server from the remote repo git pull
从远程仓库git pull
服务器上 This didn't work because in git's eyes, you could have made an entirely new someName
file, which would get clobbered by the newest remote repo's version of someName
if git wasn't awesome and prevented bad things from happening. 这是行不通的,因为在git的眼中,您可能制作了一个全新的
someName
文件,如果git效果不佳并且可以防止不良情况发生,则它将被someName
的最新远程回购版本所someName
。
The proper steps to take action would have been: 采取行动的正确步骤应该是:
git mv somename someName
on either of the local repos git mv somename someName
上执行git mv somename someName
git commit
, git push
on the same repo git commit
, git push
相同的仓库 git pull
on the other local repos git pull
其他本地存储库 and the file renaming would have worked appropriately. 文件重命名就可以正常工作。
To remedy the issue you're having you can: 要解决此问题,您可以:
mv someName somename
to revert the file back to its former local glory) on your server's repo and simply do git pull
mv someName somename
将文件恢复为以前的本地荣耀),只需执行git pull
git add someName
, git commit -m "Fixing a conflict mistake"
, git pull
(to recursively merge the commit from the remote repo to your server repo's commit), and then git push
git add someName
, git commit -m "Fixing a conflict mistake"
, git pull
(将来自远程git add someName
git commit -m "Fixing a conflict mistake"
递归合并到服务器仓库的提交),然后进行git push
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.