Skip to content

Instantly share code, notes, and snippets.

@mmichaelis
Last active April 3, 2019 08:44
Show Gist options
  • Save mmichaelis/1a1ab4cc5cfde759a5bd155d969542d0 to your computer and use it in GitHub Desktop.
Save mmichaelis/1a1ab4cc5cfde759a5bd155d969542d0 to your computer and use it in GitHub Desktop.
Based on Erik Aybar's 'Git Tip: Deleting Old Local Branches', this snippet will delete all local branches which are tracking remote branches which are gone meanwhile, for example because they already got merged.
git branch -vv|select-string "\[origin/(.*): gone\]"|%{$_.matches.groups[1].value}|%{git branch -D $_}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment