Created
October 2, 2009 18:41
-
-
Save andrewle/199991 to your computer and use it in GitHub Desktop.
Add all removed files in a git tree to the index with 'git rm'
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
#!/usr/local/bin/ruby -w | |
# Find any deleted but not index files in the git status output | |
# and add them to the index using the 'git rm' command | |
# USAGE: gir | |
`git status`.each do |s, flag| | |
flag = true if s.include? '# Changed but not updated:' | |
`git rm #{s.gsub(/#.*deleted:\s*/, '')}` if s.include? 'deleted:' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment