Removing multiple files from a Git repo that have already been deleted from disk

For Git 1.x

$ git add -u

This tells git to automatically stage tracked files -- including deleting the previously tracked files.

For Git 2.0

To stage your whole working tree:

$ git add -u :/

To stage just the current path:

$ git add -u .

If you simply run:

git add -u

git will update its index to know that the files that you've deleted should actually be part of the next commit. Then you can run "git commit" to check in that change.

Or, if you run:

git commit -a

It will automatically take these changes (and any others) and commit them.

Update: If you only want to add deleted files, try:

git ls-files --deleted -z | xargs -0 git rm
git commit

git ls-files --deleted -z | xargs -0 git rm 

might be what you are looking for.. it works for me..


You can use

git add -u

To add the deleted files to the staging area, then commit them

git commit -m "Deleted files manually"