Removing missing files from a Git repository
Submitted by Bram Schoenmakers on 26 April, 2008 - 00:11.
Tagged: git
It is a bit cumbersome to call git rm for every missing file in a directory tree tracked by Git. Fortunately, this following command will solve this problem instantly:
git ls-files -d -z | xargs -0 git update-index --remove
Note: this command works from the current working directory, not the root directory of the Git repository.