Skip to content

Instantly share code, notes, and snippets.

@qrealka
Forked from ericelliott/gitclean.sh
Created August 27, 2019 09:44
Show Gist options
  • Save qrealka/71564fd9fb1902709dcf7904db78ae6e to your computer and use it in GitHub Desktop.
Save qrealka/71564fd9fb1902709dcf7904db78ae6e to your computer and use it in GitHub Desktop.
gitclean.sh - cleans merged/stale branches from origin
git remote prune origin
git branch -r --merged master | egrep -iv '(master|develop)' | sed 's/origin\///g' | xargs -n 1 git push --delete origin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment