Skip to content

Instantly share code, notes, and snippets.

@lgersman
Created February 6, 2025 13:28
Show Gist options
  • Save lgersman/3f82c79e3fe1689d5ee3cf2da63809fb to your computer and use it in GitHub Desktop.
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
_=$(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