Skip to content

Instantly share code, notes, and snippets.

@synsa
Forked from Bertrand/grrr.sh
Created October 21, 2016 08:32
Show Gist options
  • Save synsa/c2704161d2472c74b923af6a41e67c86 to your computer and use it in GitHub Desktop.
Save synsa/c2704161d2472c74b923af6a41e67c86 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