Last active
March 19, 2019 16:21
-
-
Save icanhazstring/d7f2d82403841c148f47858f8cb763c8 to your computer and use it in GitHub Desktop.
Git delete multiple remote merged branches
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# git branch -r --merged master | |
## List all remote merged branches (master) | |
# awk -Forigin/ '/\/PVKZU-/ {print $2}' | |
## remove origin/ prefix | |
# tr '\n' ' ' | |
## Replace new line with space (to get one single argument) | |
# xargs -rt git push origin --delete | |
## remove all list branches in one single execution | |
git branch -r --merged master | awk -Forigin/ '/\/PVKZU-/ {print $2}' | tr '\n' ' ' | xargs -rt git push origin --delete |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment