Removing missing files from a Git repository
Tagged:

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.