I have a load of deleted files I want to commit.
But I don\'t want to type git rm for each one.
If i type git rm . -r it will try and delete everything.
git add -u
Will stage all changes including deletions. This is usually the simplest way forward. You can restrict it to certain paths if this is more suitable.
e.g.
git add -u ProjectX
After doing either you can use the path form of reset to 'unstage' any changes that you didn't want.
git reset -- dontcommitme.txt
To be absolutely sure that you are only staging deletions, you would have to do something like this:
git diff --name-only --diff-filter=D | xargs git rm --
Or if you have access to a GNU xargs and need to copy with whitespace in filenames:
git diff -z --name-only --diff-filter=D | xargs -0 git rm --
git commit -a
should work as long as those are your only changes (it will add all unstaged files and commit).