Skip to content

Instantly share code, notes, and snippets.

@melkorm
Last active August 29, 2015 14:07
Show Gist options
  • Save melkorm/84c9279b795f1ffe96d8 to your computer and use it in GitHub Desktop.
Save melkorm/84c9279b795f1ffe96d8 to your computer and use it in GitHub Desktop.
Remove all merged remote branches except dev and master
#!/usr/bin/env bash
branches=`git branch -r --merged | grep -v 'dev\|master' | sed 's/origin\///g'`
for i in $branches ; do
echo "Delete branch $i? (y/N)"
read delete
if [ $delete == 'y' ]; then
echo `git push origin :$i`
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment