git commit -a

今天提交git时遇到这样一个问题,我在项目里rm掉了许多文件,等到想commit的时候,发现这些被删除的文件都是not staged的状态,这要一个个的去git rm就太蛋疼了。这时候就发现了git commit -a这个命令。git

OPTIONS
-a, --all
Tell the command to automatically stage files that have been modified and >deleted, but new files you have not told Git about are not affected.

就是自动去把以前标记过的文件再标记上,包括删除的文件,可是不包括新增的文件。web