Skip to content

Instantly share code, notes, and snippets.

@jperasmus
Created April 15, 2019 10:36
Show Gist options
  • Save jperasmus/75517737060ec7070faeb7f43b073072 to your computer and use it in GitHub Desktop.
Save jperasmus/75517737060ec7070faeb7f43b073072 to your computer and use it in GitHub Desktop.
A Git terminal command to remove all local branches that have already been merged into main remote branches.
git fetch -p && git branch -vv | grep 'origin/.*: gone]' | 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