Last active
March 27, 2019 01:17
-
-
Save tgallacher/609c45f0251038fb70958e0ce98344f9 to your computer and use it in GitHub Desktop.
Git alias to prune branches
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
# Clean up branches which no longer exist on the remote | |
# | |
# @tip: Add to bash/zsh aliases | |
# @note: split over multiple lines to make it easier to read. | |
# @see: https://gist.github.com/tgallacher/cae12db973a235b52e9e5b014d21d633 | |
git fetch && \ | |
git remote prune origin && \ | |
git branch -v | \ | |
grep gone | \ | |
awk '{print $1;}' | \ | |
xargs -n 1 git branch -d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment