
### 1.撤销修改
~~~
git checkout -- <fileName>
~~~

### 2.删除文件[rm <file>]()
~~~
rm <File>
~~~
- 之后如果确定要删除文件,命令行中输入

~~~
git rm test.txt;
git commit -m "remove test.txt"
~~~
- 另一种情况是删错了,因为版本库里还有呢,所以可以很轻松地把误删的文件恢复到最新版本
~~~
git checkout -- test.txt
~~~