Skip to content

Instantly share code, notes, and snippets.

@leontiy
Created July 12, 2009 18:33
Show Gist options
  • Save leontiy/145755 to your computer and use it in GitHub Desktop.
Save leontiy/145755 to your computer and use it in GitHub Desktop.
#!/usr/local/bin/python3.0
import os
import re
def skip_updated(input):
for line in input:
if not_updated_regexp.match(line):
return
def rm_not_updated(input):
for line in input:
match = deleted_files_regexp.match(line)
if match:
path = match.group(1)
#print("deleting " + path)
os.system("git rm " + path)
deleted_files_regexp = re.compile("#\s*deleted:\s*(.*)$")
not_updated_regexp = re.compile("# Changed but not updated:")
if __name__ == '__main__':
with os.popen("git status") as input:
skip_updated(input)
rm_not_updated(input)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment