-
-
Save vovkab/8245972 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
# Publish local branch to repo and make it tracking: | |
$ git push -u origin branch_name | |
# List remote branches: | |
$ git remote show origin | |
# Show stale branches that will be removed: | |
$ git remote prune origin --dry-run | |
# Delete stale branches: | |
$ git remote prune origin | |
Branches cleanup: | |
https://jira.atlassian.com/browse/BSERV-4142 | |
# list merged branches | |
BRANCHES=`git branch -r --merged | grep -v "*" | grep -v master | grep -v develop | grep -v release/ | grep -v hotfix/ | sed 's/origin\///'` | |
printf "Removing branches: \n$BRANCHES" | |
# delete all remote branches merged into the current branch (i.e. develop), excluding release/master/develop branches | |
git branch -r --merged | grep -v "*" | grep -v master | grep -v develop | grep -v release/ | grep -v hotfix/ | sed 's/origin\///' | 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