Skip to content

Instantly share code, notes, and snippets.

@Bertrand
Created November 9, 2012 13:41
Show Gist options
  • Save Bertrand/4045714 to your computer and use it in GitHub Desktop.
Save Bertrand/4045714 to your computer and use it in GitHub Desktop.
merge master into staging and staging into testing
#!/bin/sh
git diff --quiet --exit-code
if [ $? -ne 0 ]; then
echo "Cannot run grrr if you have uncommited changes"
exit -1;
fi
current_branch=`git rev-parse --abbrev-ref HEAD`
if [ "$current_branch" == "HEAD" ]; then
echo "Cannot run grrrr if you're not on a branch"
exit -1;
fi
git checkout master && git pull --ff-only && git checkout staging && git pull --ff-only && git merge master && git push && git checkout testing && git pull --ff-only && git merge staging && git push
git checkout "$current_branch"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment