Skip to content

Instantly share code, notes, and snippets.

@aolshevskiy
Created February 11, 2012 15:29
Show Gist options
  • Save aolshevskiy/1800846 to your computer and use it in GitHub Desktop.
Save aolshevskiy/1800846 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
git pull origin master
BRANCHES=""
for branch in $(git branch -r); do
if git log ${branch}^..${branch} | grep "$1" > /dev/null ; then
branch=$(echo $branch | sed s/.*\\///)
BRANCHES="$BRANCHES $branch"
fi
done
for branch in $BRANCHES; do
git checkout $branch
git merge master
git push origin $branch
git checkout master
git branch -d $branch
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment