Skip to content

Instantly share code, notes, and snippets.

@stansidel
Forked from olistik/gitrm.sh
Last active December 18, 2015 04:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stansidel/5727449 to your computer and use it in GitHub Desktop.
Save stansidel/5727449 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Performs a git rm on every deleted file.
deletion_list=$(git status | grep deleted: | cut -c 15-)
for file in $deletion_list; do
git rm --ignore-unmatch $file
done
#!/bin/bash
for x in `git status | grep deleted | awk '{print $3}'`; do git rm $x; done
#!/bin/bash
# Unstage files staged with 'git rm'.
deletion_list=$(git status | grep deleted: | cut -c 15-)
for file in $deletion_list; do
git reset HEAD $file
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment