From eede8679e731c2ee125fcc636ffb70c558cab697 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 28 Nov 2017 19:01:47 -0600 Subject: [PATCH] Fix up git helper scripts --- buildroot/share/git/mfpub | 32 ++++++++++++++++++++------------ buildroot/share/git/mfup | 2 ++ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/buildroot/share/git/mfpub b/buildroot/share/git/mfpub index dff24f9c61..9a3e1caa6f 100755 --- a/buildroot/share/git/mfpub +++ b/buildroot/share/git/mfpub @@ -35,7 +35,7 @@ fi echo "Stashing any changes to files..." echo "Don't forget to update and push 'master'!" # GOJF Card -git stash +[[ $(git stash) != "No local "* ]] && HAS_STASH=1 COMMIT=$( git log --format="%H" -n 1 ) @@ -46,16 +46,26 @@ git clean -d -f if [[ $BRANCH == "master" ]]; then # Don't lose upstream changes! - mfup + git fetch upstream - # Allow working directly with the main fork - echo - echo -n "Pushing to origin/master... " - git push -f origin + # Rebase onto latest master + if git rebase upstream/master; then - echo - echo -n "Pushing to upstream/master... " - git push -f upstream + # Allow working directly with the main fork + echo + echo -n "Pushing to origin/master... " + git push -f origin + + echo + echo -n "Pushing to upstream/master... " + git push -f upstream + + else + + echo "Merge conflicts? Stopping here." + exit + + fi else @@ -114,6 +124,4 @@ rm -rf ${TMPFOLDER} # Go back to the branch we started from git checkout $BRANCH -if [[ $BRANCH != "master" ]]; then - git stash pop -fi +[[ $HAS_STASH == 1 ]] && git stash pop diff --git a/buildroot/share/git/mfup b/buildroot/share/git/mfup index 88b564f9fb..132c36b3b4 100755 --- a/buildroot/share/git/mfup +++ b/buildroot/share/git/mfup @@ -38,6 +38,8 @@ if [[ $BRANCH != $TARG ]]; then else echo "No such branch!" fi +else + git reset --hard upstream/$TARG fi echo