Remove local git branches on Windows with PowerShell

There is plenty of tooling and scripts for *nix systems to delete local branches, but I was struggling to find useful snippets for Windows, so I made one.

Remove-LocalBranches is available as a script on GitHub for you to download and modify to your heart's content.

It removes non-active branches from a set of directories and is designed to be run as an atomic unit (doesn't accept input).

The script is dependent on another utility script I wrote that enters a directory, runs a script block and then returns to where it were. That script is also available on GitHub.

So, to answer "how do I remove unused / old local branches", the answer is "Run Remove-LocalBranches.ps1". I hope this is useful :) 

Example run:



Comments

Popular posts from this blog

Auto Mapper and Record Types - will they blend?

Unit testing your Azure functions - part 2: Queues and Blobs

Testing WCF services with user credentials and binary endpoints