Skip to content

Instantly share code, notes, and snippets.

@benspaulding
Last active October 21, 2016 21:39
Show Gist options
  • Save benspaulding/29a900c7c7b4f89ccf6d to your computer and use it in GitHub Desktop.
Save benspaulding/29a900c7c7b4f89ccf6d to your computer and use it in GitHub Desktop.
Delete git-flow type branches that were not automatically deleted
git checkout master
git pull
git branch --all --merged master | ack hotfix/ | xargs git branch -d
git checkout dev
git pull
git branch --all --merged dev | ack feature/ | xargs git branch -d
git branch --all --merged origin/master | ack origin/hotfix/ | sed -e 's: remotes\/origin\/::' | xargs git push --delete origingit branch --all --merged origin/master | ack origin/hotfix/ | sed -e 's: remotes\/origin\/::' | xargs git push --delete origin
git branch --all --merged origin/dev | ack origin/feature/ | sed -e 's: remotes\/origin\/::' | xargs git push --delete origin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment