Skip to content

Instantly share code, notes, and snippets.

@bananita
Created November 3, 2016 14:16
Show Gist options
  • Save bananita/fe0c456feeac73c19404465bf1a57dd7 to your computer and use it in GitHub Desktop.
Save bananita/fe0c456feeac73c19404465bf1a57dd7 to your computer and use it in GitHub Desktop.
remove merged branchs
#!/bin/bash
echo Deleting merged branches...
#git pull
for b in $(git branch -a --merged develop);
do
branch=${b#"remotes/origin/"}
if [[ "$branch" == "develop" ]]; then
continue
fi
if [[ "$branch" == "master" ]]; then
continue
fi
if [[ "$branch" == "release*" ]]; then
continue
fi
echo Deleting $branch...
# git branch -d $branch
git push origin :$branch
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment