Created
March 2, 2012 08:52
-
-
Save olistik/1956924 to your computer and use it in GitHub Desktop.
Stage/unstage deleted files in a git project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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