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

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

~~~
git rm test.txt;
git commit -m "remove test.txt"
~~~
- 另一種情況是刪錯了,因為版本庫里還有呢,所以可以很輕松地把誤刪的文件恢復到最新版本
~~~
git checkout -- test.txt
~~~