Last active
November 9, 2020 11:32
-
-
Save byF/ec41e20986539ab4d5c2ad77e1a881df to your computer and use it in GitHub Desktop.
Put the git-prune-local script on your PATH: git prune-local
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/sh | |
. "$(git --exec-path)/git-sh-setup" | |
USAGE="" | |
_prune_local() { | |
if [ $# = 0 ]; then | |
# git 2.21+ | |
# -D is aggressive, beware | |
git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D | |
# more lenient version, depends on your workflow | |
# git fetch -p && git branch -vv --merged | awk '/: gone]/{print $1}' | xargs git branch -d | |
else | |
usage | |
fi | |
} | |
_prune_local |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment