刪除文件的方法
nelsen-mac:learngit mac$ rm file.txt
這個時候git發現工作區和版本庫就不一致了,git status
命令會顯示哪些文件被刪除了:
nelsen-mac:learngit mac$ 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: file.txt
no changes added to commit (use "git add" and/or "git commit -a")
按提示操作,選擇一,git add/rm效果是一樣的
這樣文件就被刪除了