Skip to content

Instantly share code, notes, and snippets.

@Velrok
Created January 31, 2013 23:00
Show Gist options
  • Save Velrok/4687505 to your computer and use it in GitHub Desktop.
Save Velrok/4687505 to your computer and use it in GitHub Desktop.
Removes all branches that have been already merge into master.
#!/usr/bin/env python
from sh import git
def main():
print "before:"
print git('br')
for br in git('br', '--no-color'):
br = br.strip()
if "master" in br: continue
git("br", "-d", br)
print "now:"
print git('br')
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment