Git learned delete files
I hit a bit of a problem
$ touch test.txt $ git add test.txt $ git commit -m "add test.txt" On branch master nothing to commit, working tree clean $ git status On branch master nothing to commit, working tree clean $ git rm test.txt rm 'test.txt' $ git checkout -- test.txt error: pathspec 'test.txt' did not match any file(s) known to git
After the inquiry know, git rm command Git test.txt file in the temporary area is deleted, so this command is useless, because the checkout command simply restores the work area to look staging area, and now the staging area Without papers, naturally not able to find the file
To restore a file test.txt will come staging area recovery
$ git reset <filename>
Recover before use
$ git checkout -- test.txt