github - Git issues of leaving a "deleted" file forever which can not do anything to it -
one of git repos (managed on github @ https://github.com/quchunguang/test), leave file "deleted" state when git status
.
i cannot git add
it, git rm
or other thing remove it. tried git fsck --full
no error detected. deleted entire repos , git clone
github, issues still there.
this happened on windows 10 64-bit system, git 64-bit (git version 2.8.0.windows.1).
$ git status on branch master branch ahead of 'origin/master' 1 commit. (use "git push" publish local commits) changes not staged commit: (use "git add/rm <file>..." update committed) (use "git checkout -- <file>..." discard changes in working directory) deleted: run_myscript.py no changes added commit (use "git add" and/or "git commit -a")
you have 2 files, "run_myscript.py" , "run_myscript.py ", same contents in repo. (the latter 1 has trailing space.)
windows filesystem ignores (removes) trailing spaces in file name, , "run_myscript.py" overwritten "run_myscript.py " during cloning , git complaining can't find "run_myscript.py ".
you can resolve issue following commands:
git rm "testpy/ipython/run_myscript.py " git commit -m "remove duplicate of run_myscript.py." git checkout testpy/ipython/run_myscript.py
note last checkout needed because "run_myscript.py" (one without trailing space) deleted git rm
file system somehow.
Comments
Post a Comment