Git: How to revert 2 files that are stubbornly stuck at “Changed but not committed”?

后端 未结 12 746
北海茫月
北海茫月 2020-12-22 19:15

I have a repo that has two files that supposedly I changed locally.

So I\'m stuck with this:

$ git status
# On branch master
# Changed but not update         


        
12条回答
  •  半阙折子戏
    2020-12-22 19:37

    You also might have had a problem related to directories naming letter cases. Some of your colleagues could have changed the name of the directory from e.g. myHandler to MyHandler. If you later on pushed and pulled some of the files of the original directory you would have had 2 separate directories on the remote repository AND only one on your local machine since on Windows you only can have just one. And you're in trouble.

    To check if that is the case, just see if the remote repository has double structure.

    To fix this, make a backup copy of the parent directory outside of the repo, then delete the parent directory, push it. Make a pull (here's when the second one marked as deleted should appear on status) and push again. After that, recreate the whole structure from your backup and push the changes again.

提交回复
热议问题