Last active
January 31, 2018 12:06
-
-
Save kanikash4/643c447e85eae71e28e85b6b08bc6f77 to your computer and use it in GitHub Desktop.
Delete open but merged branches from production environment
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
# Delete a single open branch but merged branch from production environment | |
git push origin :remotes/origin/<branch_name> | |
#Delete all open but merged branches from production environment | |
for i in `git branch -r --merged production | grep -v "production" | awk -F / '{print $2}'`; do git push origin :$i; done | |
# check remaining branches count | |
git branch -a | wc -l |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment