删除文件 - morris131/morris-book GitHub Wiki
- 新建test.txt
delete test
$ git status
On branch master
Untracked files:
(use "git add ..." to include in what will be committed)
test.txt
nothing added to commit but untracked files present (use "git add" to track)
- 添加到版本库
$ git add test.txt
$ git status
On branch master
Changes to be committed:
(use "git reset HEAD ..." to unstage)
new file: test.txt
$ git commit -m "add test.txt"
[master 120dab8] add test.txt
1 file changed, 1 insertion(+)
create mode 100644 test.txt
- 删除test.txt
$ rm test.txt
$ git status
On branch master
Changes not staged for commit:
(use "git add/rm ..." to update what will be committed)
(use "git checkout -- ..." to discard changes in working directory)
deleted: test.txt
no changes added to commit (use "git add" and/or "git commit -a")
- 提交
$ git add test.txt
$ git status
On branch master
Changes to be committed:
(use "git reset HEAD ..." to unstage)
deleted: test.txt
$ git commit -m "delete test"
[master b0e9ec8] delete test
1 file changed, 1 deletion(-)
delete mode 100644 test.txt