Last Updated: July 24, 2020
·
1.472K
· fuadsaud

Stage all git deletions

Do you often delete files from your git repositories using rm or your text editor/ide file browser? Then you have to git rm all those deleted files, one each time... This little command should help you:

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

It supplies git rm with a list of all deleted files on your repository. I use it as git stage-deletions

UPDATE

As pointed by @mlafeldt, if you want to combine this command with a git add you can use git add -u, which will stage all modified - but not untracked - files.