Bash script to remove deleted files from git

Posted by – March 7, 2008

for i in ` git st | grep deleted | awk ‘{print $3}’ ` ; do git rm $i; done

3 Comments on Bash script to remove deleted files from git

Respond | Trackback

  1. Santi says:

    Another way:

    git ls-files –deleted | xargs git rm

  2. Bjørn says:

    And if you don’t mind changed files also added to the index:

    git add -u

  3. Actually there is one better:

    git ls-files –deleted | xargs –no-run-if-empty git rm

Respond

Comments

Comments