How can I use only modified (and not new or deleted) files?


git status shows a bunch of files which were modified and some which were deleted. I want to first commit the modified files and then the deleted ones. I don't see any option in git add that enables me to do this. How can I do it?

EDIT: As pointed out, git add wouldn't have staged the deleted files anyway, so git add . would do. But it has the side-effect of including files which weren't tracked, which I would also like to avoid. I have changed the title of the question accordingly.

The following command should do the trick:

git commit -a


git commit -am "commit message"

From the Pro Git book:

Providing the -a option to the git commit command makes Git automatically stage every file that is already tracked before doing the commit