1.在工作区用rm命令删了:
$ rm test.txt
2 .git status命令会立刻告诉你哪些文件被删除了:
$ git status
On branch master
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
deleted: test.txt
no changes added to commit (use "git add" and/or "git commit -a")
3.用命令git rm删掉,并且git commit:
$ git rm test.txt
rm 'test.txt'
$ git commit -m "remove test.txt"
[master d46f35e] remove test.txt
1 file changed, 1 deletion(-)
delete mode 100644 test.txt
现在,文件就从版本库中被删除了。
本文详细介绍如何使用Git命令从工作区及版本库中彻底删除文件。首先,在工作区使用rm命令删除文件;接着,通过git status命令查看已删除的文件状态;最后,利用git rm命令正式从版本库中移除文件,并通过git commit进行提交确认。
2847

被折叠的 条评论
为什么被折叠?



