Last active
July 29, 2026 23:49
-
-
Save jonathanfann/f6eedb35eb160a53627b1fed55772925 to your computer and use it in GitHub Desktop.
Git Prune zsh choice
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
| ## this can be in your .zshrc | |
| function pruneBranches() { | |
| echo "thinkin..." | |
| git fetch --prune | |
| local lostInTheWoods=$(git branch -vv | grep 'gone]' | awk '{print $1}') | |
| if [[ -z "$lostInTheWoods" ]]; then | |
| echo "\nain't nuthin to prune" | |
| return | |
| fi | |
| if read -q "choice?going to prune...ok? [y/N]"; then | |
| echo "$lostInTheWoods" | |
| else | |
| echo | |
| echo "'$choice' not 'y' so not pruning." | |
| fi | |
| } | |
| alias doPrune="pruneBranches" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment