Skip to content

Instantly share code, notes, and snippets.

@ctolkien
Created July 3, 2018 01:55
Show Gist options
  • Save ctolkien/2bca8a7eac9a4c3cba5ccbbcb45e5ac9 to your computer and use it in GitHub Desktop.
Save ctolkien/2bca8a7eac9a4c3cba5ccbbcb45e5ac9 to your computer and use it in GitHub Desktop.
Git Remove Branches Merged Upstream
function Git-RemoveBranchesMergedUpStream {
git fetch -p | git remote prune origin | git branch -vv |
select-string ": gone]" |
ForEach-Object { $_.Line.Substring(2, $_.Line.IndexOf(' ', 2)) } |
ForEach-Object { git branch -d $_ }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment