Skip to content

Instantly share code, notes, and snippets.

@sajoku
Forked from earlonrails/merged_branches.sh
Created March 19, 2014 08:33
Show Gist options
  • Save sajoku/9637658 to your computer and use it in GitHub Desktop.
Save sajoku/9637658 to your computer and use it in GitHub Desktop.
merged_branches(){
local current_branch=$(git rev-parse --abbrev-ref HEAD)
for branch in $(git branch --merged | cut -c3-)
do
echo "Branch $branch is already merged into $current_branch."
echo "Would you like to delete it? [Y]es/[N]o "
read REPLY
if [[ $REPLY =~ ^[Yy] ]]; then
git branch -d $branch
fi
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment