1. 在second.txt添加以后内容。
2.
$ git status
On branch master
Changes not staged for commit:
(use “git add …” to update what will be committed)
(use “git checkout – …” to discard changes in working directory)
modified: second.txt
no changes added to commit (use “git add” and/or “git commit -a”)
3. 看到文件在工作区被修改了
4. 看提示 使用git checkout -- <file> 可以撤销修改
5.
$ git checkout – second.txt
6. cat second.txt
7. 工作区修改的文本被撤销