Skip to content

Instantly share code, notes, and snippets.

@kennyk
Last active February 20, 2018 08:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kennyk/8104728b5d9be2b5fc33ca4688693ba3 to your computer and use it in GitHub Desktop.
Save kennyk/8104728b5d9be2b5fc33ca4688693ba3 to your computer and use it in GitHub Desktop.
Delete local copies of remote branches
Branches that are local only will not be touched.
Branches that have been deleted on remote but were not merged will show a notification but not be deleted on local.
If you want to delete those as well change `-d` to `-D`.
git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment