Skip to content

Instantly share code, notes, and snippets.

@keithpitty
Created October 11, 2015 23:19
Show Gist options
  • Save keithpitty/eba5f5ae4bd2bceb991d to your computer and use it in GitHub Desktop.
Save keithpitty/eba5f5ae4bd2bceb991d to your computer and use it in GitHub Desktop.
Script to cleanup old local git branches
#!/bin/bash
echo "Deleting the following branches that have been merged into master:"
git branch --merge master | grep -v "\* master"
git branch --merge master | grep -v "\* master" | xargs -n 1 git branch -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment