Created
October 22, 2019 06:06
-
-
Save codejockie/34dc8468daa864f8644f310dd0bca8d5 to your computer and use it in GitHub Desktop.
A tiny utility function to delete old (unused) git branches
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
| function deleteOldBranches() { | |
| for branchName in $(git branch) | |
| do | |
| # We do not want to delete the master branch | |
| if [ $branchName != 'master' ] && [ $branchName != '*' ] | |
| then | |
| echo 🛠 Deleting $branchName | |
| git branch -D $branchName | |
| fi | |
| done | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment