Discuss / Git / git rm 删除不了版本库里的东西

git rm 删除不了版本库里的东西

Topic source

[root@JDu4e00u53f7 git]# touch 5.py [root@JDu4e00u53f7 git]# vim 5.py [root@JDu4e00u53f7 git]# git add 5.py [root@JDu4e00u53f7 git]# git commit -m 'add 5.py' [master 780ea54] add 5.py 1 file changed, 1 insertion(+) create mode 100644 5.py [root@JDu4e00u53f7 git]# ls 5.py [root@JDu4e00u53f7 git]# rm -rf 5.py [root@JDu4e00u53f7 git]# ls [root@JDu4e00u53f7 git]# git rm 5.py rm '5.py' [root@JDu4e00u53f7 git]# git commit -m 'del 5.py' [master 97a56d3] del 5.py 1 file changed, 1 deletion(-) delete mode 100644 5.py [root@JDu4e00u53f7 git]# git status

On branch master

nothing to commit, working directory clean [root@JDu4e00u53f7 git]# git reflog 97a56d3 HEAD@{0}: commit: del 5.py 780ea54 HEAD@{1}: commit: add 5.py [root@JDu4e00u53f7 git]# git checkout 5.py error: pathspec '5.py' did not match any file(s) known to git. [root@JDu4e00u53f7 git]# git reset --hard 780ea54 HEAD is now at 780ea54 add 5.py [root@JDu4e00u53f7 git]# ls 5.py

陈chris98

#2 Created at ... [Delete] [Delete and Lock User]

git里删除还原出来了吧


  • 1

Reply