Last active
April 8, 2021 05:22
-
-
Save element6/1b59729dfc4b4ca95285a3e983a85612 to your computer and use it in GitHub Desktop.
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
#may need to update local branches fist | |
git remote update origin --prune | |
# get all branches that are merged into release | |
# remove the origin/ prefix | |
# make sure we don't delete release, develop and HEAD branches | |
# remove them | |
git branch -r --merged origin/release | sed 's/origin\///' | grep -vwE "(develop|HEAD|release)$" | xargs -n 1 git push origin --delete | |
#for develop | |
git branch -r --merged origin/develop | sed 's/origin\///' | grep -vwE "(develop|HEAD|release)$" | xargs -n 1 git push origin --delete | |
# should preview the list first | |
git branch -r --merged origin/release | sed 's/origin\///' | grep -vwE "(release|develop|HEAD)$" | |
# clean up local branches that have already been merged to develop | |
git branch --merged develop | sed 's/origin\///' | grep -vwE "(develop|HEAD|release)$" | xargs -n 1 git branch -d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment