我正在尝试git pull origin master,但是本地文件有问题。 这个本地文件已经在我的gitignore中,但是我仍然遇到此错误:
error: Your local changes to the following files would be overwritten by merge
我尝试过:
第二次尝试返回:
error: Entry 'myfolder/myfile' not uptodate. Cannot merge.
fatal: Could not reset index file to revision 'origin/master'.
我的git状态输出:
On branch master
Your branch is behind 'origin/master' by 119 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
nothing to commit, working tree clean
答案 0 :(得分:0)
我能够删除导致问题的文件,但这并不是最佳解决方案。
答案 1 :(得分:0)
for the future, the problem was caused by that local file being changed, you can use git stash in order to temporarily store the changes and use git pull to get the remote version, then use git stash pop to return the local file to the changes you had.
in terms of the file being in the git ignore, you would need to run git rm --cached
for the changes to be ignored if you added to the .gitignore after you made the changes