Skip to content

Instantly share code, notes, and snippets.

@wizact
Created December 17, 2019 04:30
Show Gist options
  • Save wizact/1bf95f07c13666d045a028f13d8b3af1 to your computer and use it in GitHub Desktop.
Save wizact/1bf95f07c13666d045a028f13d8b3af1 to your computer and use it in GitHub Desktop.
Delete all merged branches
#!/bin/bash
git checkout master
for branch_name in $(git branch --merged| egrep -v "(^\*|master|release|integrate)")
do
git tag archive/$branch_name $branch_name
git branch -d $branch_name
done
git tag | grep archive/ | xargs -n 1 git push -d origin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment