Skip to content

Instantly share code, notes, and snippets.

@mcmatrix
Forked from Bertrand/grrr.sh
Created June 22, 2018 17:36
Show Gist options
  • Select an option

  • Save mcmatrix/0f909d2aecf2a011ad411248748de0ad to your computer and use it in GitHub Desktop.

Select an option

Save mcmatrix/0f909d2aecf2a011ad411248748de0ad 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