Jon Evans, CC BY 2.0 GitDelete all local git branches while retaining the master August 17, 2026July 10, 2014 by Jean-Pierre LambeletAfter a sprint, all the local branches you have are useless and take up space. Below is a small command to remove them (except master) git branch | grep -v "master" | xargs git branch -D