Browse Source

Fix up git helper scripts

Scott Lahteine 6 years ago
parent
commit
a6d39b7192
2 changed files with 22 additions and 12 deletions
  1. 20
    12
      buildroot/share/git/mfpub
  2. 2
    0
      buildroot/share/git/mfup

+ 20
- 12
buildroot/share/git/mfpub View File

35
 echo "Stashing any changes to files..."
35
 echo "Stashing any changes to files..."
36
 echo "Don't forget to update and push 'master'!"
36
 echo "Don't forget to update and push 'master'!"
37
 # GOJF Card
37
 # GOJF Card
38
-git stash
38
+[[ $(git stash) != "No local "* ]] && HAS_STASH=1
39
 
39
 
40
 COMMIT=$( git log --format="%H" -n 1 )
40
 COMMIT=$( git log --format="%H" -n 1 )
41
 
41
 
46
 if [[ $BRANCH == "master" ]]; then
46
 if [[ $BRANCH == "master" ]]; then
47
 
47
 
48
   # Don't lose upstream changes!
48
   # Don't lose upstream changes!
49
-  mfup
49
+  git fetch upstream
50
 
50
 
51
-  # Allow working directly with the main fork
52
-  echo
53
-  echo -n "Pushing to origin/master... "
54
-  git push -f origin
51
+  # Rebase onto latest master
52
+  if git rebase upstream/master; then
55
 
53
 
56
-  echo
57
-  echo -n "Pushing to upstream/master... "
58
-  git push -f upstream
54
+    # Allow working directly with the main fork
55
+    echo
56
+    echo -n "Pushing to origin/master... "
57
+    git push -f origin
58
+
59
+    echo
60
+    echo -n "Pushing to upstream/master... "
61
+    git push -f upstream
62
+
63
+  else
64
+
65
+    echo "Merge conflicts? Stopping here."
66
+    exit
67
+
68
+  fi
59
 
69
 
60
 else
70
 else
61
 
71
 
114
 # Go back to the branch we started from
124
 # Go back to the branch we started from
115
 git checkout $BRANCH
125
 git checkout $BRANCH
116
 
126
 
117
-if [[ $BRANCH != "master" ]]; then
118
-  git stash pop
119
-fi
127
+[[ $HAS_STASH == 1 ]] && git stash pop

+ 2
- 0
buildroot/share/git/mfup View File

38
   else
38
   else
39
     echo "No such branch!"
39
     echo "No such branch!"
40
   fi
40
   fi
41
+else
42
+  git reset --hard upstream/$TARG
41
 fi
43
 fi
42
 
44
 
43
 echo
45
 echo

Loading…
Cancel
Save