Skip to content

Instantly share code, notes, and snippets.

@milanboers
Last active July 12, 2021 08:34
Show Gist options
  • Save milanboers/9eff75cc2f05c48fcc532e7188dbd906 to your computer and use it in GitHub Desktop.
Save milanboers/9eff75cc2f05c48fcc532e7188dbd906 to your computer and use it in GitHub Desktop.
Delete all merged git branches on remote origin. Excludes "master" and "develop" branches.
git fetch -p; git branch -r --merged master | grep -Ev 'master|develop|main' | sed 's/origin\///' | xargs -n1 git push --delete origin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment