Skip to content

Instantly share code, notes, and snippets.

@bluejack
Created July 22, 2024 16:29
Show Gist options
  • Save bluejack/e98a931a6d2f1de17b8ca1f5db7bbd40 to your computer and use it in GitHub Desktop.
Save bluejack/e98a931a6d2f1de17b8ca1f5db7bbd40 to your computer and use it in GitHub Desktop.
zsh function for removing local branches that are no longer in the remote repository
gitclean () {
for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`
do
git branch -D $branch
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment