Remove deleted files from Git's index

If a lot of files have been deleted from the directory using rm rather than git rm and it is required to remove them from Git's index as well, use

for i in `git status | grep deleted | awk '{print $3}'`; do git rm $i; done

See Remove Deleted Files From Git

Copyright © Ben Bullock 2009-2022. All rights reserved. For comments, questions, and corrections, please email Ben Bullock ( or use the discussion group at Google Groups. / Privacy / Disclaimer