This example can be used as is. Just copy and paste it to your Powershell and it will delete all local orphaned tracking branches.
Last active
April 3, 2019 08:44
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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