Skip to content

Instantly share code, notes, and snippets.

@jesuscast
Last active December 20, 2015 00:19
Show Gist options
  • Save jesuscast/6040997 to your computer and use it in GitHub Desktop.
Save jesuscast/6040997 to your computer and use it in GitHub Desktop.
Removes all of the deleted files in git if there is any modified neither new files on stage
import subprocess
import re
def rmAll():
output = subprocess.check_output("git status", shell=True)
matches = re.findall('deleted: .*', output)
for n in matches:
clean = n.replace("deleted: ","")
subprocess.call("git rm "+clean, shell=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment