Skip to content

Instantly share code, notes, and snippets.

@delacruz-dev
Last active February 27, 2019 14:54
Show Gist options
  • Save delacruz-dev/f85d1e87a1f486ccac1ab29721668ba9 to your computer and use it in GitHub Desktop.
Save delacruz-dev/f85d1e87a1f486ccac1ab29721668ba9 to your computer and use it in GitHub Desktop.
Removes all local branches in a git repository which are already merged or deleted from origin.
git fetch -p && for branch in `git branch -vv --no-color | 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