Skip to content

Instantly share code, notes, and snippets.

@adhumi
Created August 3, 2016 09:09
Show Gist options
  • Save adhumi/af6b04a2fc3bc2e9be52a364f8ee6b35 to your computer and use it in GitHub Desktop.
Save adhumi/af6b04a2fc3bc2e9be52a364f8ee6b35 to your computer and use it in GitHub Desktop.
A script to easily cleanup the branches of a git repository
#! /bin/sh
# cleanup_git_branches <folder>
pwd=$(pwd)
cd $1
for branch in $(git branch | cut -c 3-); do
printf "Delete \e[32m$branch\e[0m ? (y/n, default 'no') "
read var
if [[ $var == "y" ]]
then
git branch -D $branch
fi
done
cd $pwd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment