Last active
November 16, 2016 15:17
-
-
Save mario21ic/f447f98cddba8003769ed8374efe7861 to your computer and use it in GitHub Desktop.
Remove all unnecessary branches with prefix local and remote
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 | |
# Prefijo de las ramas a eliminar | |
PREFIX="APT" | |
# Sincroniza | |
git fetch origin --prune | |
# Limpia localmente | |
git branch|grep $PREFIX|xargs git branch -D | |
# Limpia remotamente | |
branchs_remote=$(git branch -r|grep $PREFIX|awk '{print substr($1,8) }') | |
for branch in $branchs_remote | |
do | |
git push origin --delete $branch | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment