Git Quick Tip – Remove all “changed but not updated” deleted files

When you run status and see a lot of files that have been deleted but are still in git, such as:

deleted:    vendor/cache/annotate-2.4.0.gem

You either have to do `git rm` for each file, or you can use this command to remove them all from the git repository:

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

Now your git status is nice and tidy again, and your git repository has been slimmed down.

Leave a Reply

Your email address will not be published. Required fields are marked *