Skip to content

Instantly share code, notes, and snippets.

@organom
Last active August 24, 2021 12:13
Show Gist options
  • Save organom/45d6db621459b05d451d901edf7e3bd7 to your computer and use it in GitHub Desktop.
Save organom/45d6db621459b05d451d901edf7e3bd7 to your computer and use it in GitHub Desktop.
Remove local git branches not in remote
#!/bin/bash
git remote prune origin
git branch -vv | grep ': gone]'| grep -v "\*" | awk '{ print $1; }' | xargs -r git branch -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment