Skip to content

Instantly share code, notes, and snippets.

@flaviomuniz
Created November 23, 2016 01:08
Show Gist options
  • Save flaviomuniz/e282945dcff9253066dd53d8fb157c09 to your computer and use it in GitHub Desktop.
Save flaviomuniz/e282945dcff9253066dd53d8fb157c09 to your computer and use it in GitHub Desktop.
Git clear branch merged
#!/bin/sh
set -x
git checkout master
git fetch
git pull
git branch -r --merged | grep origin | grep -v '>' | grep -v master | xargs -L1 | cut -d"/" -f2- | xargs git push origin --delete
git branch --merged | grep -v master | xargs git branch -d
git fetch -p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment