Skip to content

Instantly share code, notes, and snippets.

@jkakar
Last active December 25, 2015 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkakar/7036756 to your computer and use it in GitHub Desktop.
Save jkakar/7036756 to your computer and use it in GitHub Desktop.
[alias]
cleanbranches = !/Users/jkakar/bin/gitcleanbranches.sh
#!/bin/bash
set -x
git checkout master
git pull origin master
for branch in `git branch -a --merged | grep -v HEAD | grep -v '*' | tr -d ' ' | cut -d / -f 3 -s | grep -v master`
do
git branch -d $branch
git push origin :refs/heads/$branch
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment