标签:status style ash user directory deletion comm and direct
Administrator@USER-20200307HH MINGW64 /f/Git (master) $ rmdir README.md rmdir: failed to remove ‘README.md‘: Not a directory-------------------------------------->删目录的命令
Administrator@USER-20200307HH MINGW64 /f/Git (master) $ rm -rf README.md
Administrator@USER-20200307HH MINGW64 /f/Git (master) $ git status On branch master Changes not staged for commit: (use "git add/rm <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory)--------------------------------->这个是撤销删除了 deleted: README.md no changes added to commit (use "git add" and/or "git commit -a") Administrator@USER-20200307HH MINGW64 /f/Git (master) $ git add README.md Administrator@USER-20200307HH MINGW64 /f/Git (master) $ git status On branch master Changes to be committed: (use "git restore --staged <file>..." to unstage) deleted: README.md Administrator@USER-20200307HH MINGW64 /f/Git (master) $ git commit -"clear" fatal: could not lookup commit lear-------------------------------------------------------->所以这样做的是错的。删除一个应该用git rm Administrator@USER-20200307HH MINGW64 /f/Git (master) $ git status On branch master Changes to be committed: (use "git restore --staged <file>..." to unstage) deleted: README.md Administrator@USER-20200307HH MINGW64 /f/Git (master) $ git restore --staged README.md---------------------------------------------------------------> 把删除撤销了 Administrator@USER-20200307HH MINGW64 /f/Git (master) $ git status On branch master Changes not staged for commit: (use "git add/rm <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory) deleted: README.md no changes added to commit (use "git add" and/or "git commit -a")
现在正真才是在干删除的事情:
Administrator@USER-20200307HH MINGW64 /f/Git (master) $ git rm README.md rm ‘README.md‘ Administrator@USER-20200307HH MINGW64 /f/Git (master) $ git status On branch master Changes to be committed: (use "git restore --staged <file>..." to unstage) deleted: README.md Administrator@USER-20200307HH MINGW64 /f/Git (master) $ git commit -m"trash" [master 4b0a1dc] trash 1 file changed, 1 deletion(-) delete mode 100644 README.md Administrator@USER-20200307HH MINGW64 /f/Git (master) $ git status On branch master nothing to commit, working tree clean
标签:status style ash user directory deletion comm and direct
原文地址:https://www.cnblogs.com/penen/p/12838791.html