Skip to content

Instantly share code, notes, and snippets.

@cedriclombardot
Last active February 10, 2021 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cedriclombardot/2871347 to your computer and use it in GitHub Desktop.
Save cedriclombardot/2871347 to your computer and use it in GitHub Desktop.
Delete git merged branch with confirmation
# List dist branch merged | exclude master, HEAD and develop | remove origin/ | delete remote branch asking confirmation
git branch -r --merged | grep -vw "master" | grep -vw "HEAD" | grep -vw "develop" | sed -e "s/origin\///g" | sed -e 's/^[[:space:]]*//' | xargs -p -I {} git push origin :{}
@Fabex
Copy link

Fabex commented Jul 20, 2012

Usage :

git co develop
git pull --ff-only origin develop
git fetch --all --prune
# run command

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment