Created
February 6, 2025 13:28
-
-
Save lgersman/3f82c79e3fe1689d5ee3cf2da63809fb to your computer and use it in GitHub Desktop.
GIT Tip : remove only locally existing branches interactively using gum #gum #bash #git #terminal
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
_=$(git branch -vv | grep ': gone]' | \ | |
awk '{print $1}' | \ | |
gum choose --header="Select local only branches to delete" --no-limit) | |
[[ "$?" == '0' ]] && \ | |
printf "Will delete the following branches locally:\n$_\n" && \ | |
gum confirm --show-output 'Do you agree?' && (printf "$_" | \ | |
xargs -n 1 git branch -dvf) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment