Last active
March 2, 2021 10:28
-
-
Save gionniboy/0b0452cec9c153c64230d78629ec5647 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!/bin/bash | |
| cd $1 | |
| echo Pulling branches | |
| git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done | |
| echo Cleaning | |
| for BRANCH in $(git branch --merged| egrep -v "(^\*|master|develop)") | |
| do | |
| git branch -d $BRANCH | |
| git push --delete origin $BRANCH | |
| done | |
| echo Purging from remote | |
| git remote prune origin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment