Created
July 22, 2008 13:36
-
-
Save digitalronin/948 to your computer and use it in GitHub Desktop.
Ruby script to automatically "git rm" deleted files
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/bin/env ruby | |
# Ruby script to automatically "git rm" deleted files | |
DELETED_REXP = /^#\s+deleted:\s+(.*)/ | |
MARKER_LINE = '# Changed but not updated:' | |
lines = `git status` | |
found_marker = false | |
lines.split("\n").each do |line| | |
found_marker = true if line == MARKER_LINE | |
next unless found_marker | |
if line =~ DELETED_REXP | |
`git rm #{$1}` | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
see http://stackoverflow.com/questions/492558/git-rm-multiple-files-that-have-already-been-deleted-from-disk