Created
April 8, 2019 18:16
-
-
Save shanerk/95e773887d2daeb249b656ab5db45e50 to your computer and use it in GitHub Desktop.
Git Script to Delete Local Branches Removed from the Remotes
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
# Creates alias which does the following: | |
# 1. Changes to master branch | |
# 2. Performs a fetch | |
# 3. Attempts to delete branches which have been removed from remote | |
# 4. Performs a verbose branch list | |
alias gitclean="git checkout master; git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done; git branch -vv" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment