Skip to content

Instantly share code, notes, and snippets.

@jumarome
Created June 7, 2017 14:50
Show Gist options
  • Select an option

  • Save jumarome/986b8f3d0d38599c6dbc81415d92387e to your computer and use it in GitHub Desktop.

Select an option

Save jumarome/986b8f3d0d38599c6dbc81415d92387e to your computer and use it in GitHub Desktop.
Remove local branches that do not exist in remote
git fetch --prune
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