Last active
February 6, 2019 00:48
-
-
Save selfup/babc75e0aa1b24d3bfac198066c960ed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# git sync upstream | |
function gsu() { | |
set -e | |
UPSTREAM_CHECK=$(git remote -v | grep upstream || echo '') | |
if [[ $UPSTREAM_CHECK == '' ]] | |
then | |
echo "NO UPSTREAM SET -- ABORTING" | |
exit 1 | |
fi | |
MASTER_CHECK=$(git status | grep 'On branch master' || echo '') | |
if [[ $MASTER_CHECK == '' ]] | |
then | |
echo "NOT ON MASTER -- ABORTING" | |
exit 1 | |
fi | |
CLEAN_CHECK=$(git status | grep 'nothing to commit, working tree clean' || echo '') | |
if [[ $CLEAN_CHECK == '' ]] | |
then | |
echo "BRANCH IS NOT CLEAN -- ABORTING" | |
exit 1 | |
fi | |
git fetch upstream | |
git rebase upstream/master | |
git push origin master | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment