$ cat "

Git-removing Files Marked as Deleted


If you work in an environment where not all file operations are made through git you probably have been in the situation that files have been deleted by using just plain rm rather than git rm, so you have to manually do a git rm for each deleted file and then commit the deletion.

To make this step a little bit easier you can use the following command:

git rm $(git ls-files -d)

It might be a good idea to either alias this command or put it in a shell script somewhere in your path, to make it easier to use.

There is actually a much better way to solve the problem where the deletions are not added, which is to add the --all flag to the git add:

git add . --all

Written by Erik Öjebo 2010-11-23 08:46