首先创建一个test.txt文件并提交分支中。
$ touch test.txt
$ git add test.txt
$ git commit -m "add test.txt"
一般删除文件时会使用rm指令来删除文件
$ rm test.txt
这是有两种情况:
(1)就是要删除这个文件,并更新版本库
$ git rm test.txt
$ git commit -m "remove test.txt"
(2)一种是删错了,需要从版本库中恢复
$ git checkout -- test.txt
浙公网安备 33010602011771号