See git gone: cleaning stale local branches.
MIT License
- Store the bash script
git-gonewhere you want (here: C:\users<username>) - Edit your .bashrc file and add the path to the PATH variable:
export PATH=$PATH:~/ - Open a Git bash and type the following command to ensure you see the usage instructions:
$ git gone - Type the following commands to clean your local branches:
$ git gone -pn $ git gone -d $ git gone -D $ git branch --merged | grep -v "\*" | grep "wip/\|pr/" | xargs git branch -d