Skip to content

Instantly share code, notes, and snippets.

@roma-glushko
Last active October 29, 2021 07:47
Show Gist options
  • Save roma-glushko/694447b1ce1c253c607843b5f4a78d13 to your computer and use it in GitHub Desktop.
Save roma-glushko/694447b1ce1c253c607843b5f4a78d13 to your computer and use it in GitHub Desktop.
Remove all local branches that don't exist on the remote anymore (works with rebase merging strategy)
git fetch -p
git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment