Skip to content

Instantly share code, notes, and snippets.

@scottgulliver
scottgulliver / delete_branches.ps1
Created January 31, 2018 12:14
Delete all branches other than dev
git branch | Select-String -Pattern "^* dev$" -NotMatch | foreach { $_ -replace "^ ", "" } | foreach { git branch -d $_ }
@scottgulliver
scottgulliver / checkout_branches.ps1
Created January 31, 2018 12:03
Powershell script to checkout all remote git branches
git branch -r | Select-String -Pattern "->" -NotMatch | Select-String -pattern "^ origin/" | foreach { $_ -replace '^ origin/', '' } | Foreach { git checkout $_ }