Skip to content

Instantly share code, notes, and snippets.

@asmega
Created January 16, 2012 11:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asmega/1620431 to your computer and use it in GitHub Desktop.
Save asmega/1620431 to your computer and use it in GitHub Desktop.
delete remote merged git branches
git branch -r --merged develop | sed 's/ *phil\///' | grep -v 'master$' | grep -v 'develop$' | grep -v '^ dave' | grep -v '^ kevinbrowne' | xargs -I% git push phil :%
# mostly likely change the first part to master. use this branch to test if things have been merged in
# sed part. use this to remove the name of your remote in my case phil. most likely to be origin
# grep any branches you want to keep
# last part. change name to your remote
# you can do a dry run by removing the last section
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment