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.
Back on my server, I have run git pull
and now it's saying:
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
?
Thanks
What can I do so the git pull
To summate what happened:
mv somename someName
on the server (which is essentially another local repo) This caused git to see that somename
was deleted and also found that someName
was a new untracked file.
git mv somename someName
on your local repo Git correctly tracks this as a file rename and handles it appropriately. 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 pull
onto your server from the remote repo 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.
The proper steps to take action would have been:
git mv somename someName
on either of the local repos git commit
, git push
on the same repo git pull
on the other local repos 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
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.