Преглед на файлове

Fix up git helper scripts

Scott Lahteine преди 7 години
родител
ревизия
eede8679e7
променени са 2 файла, в които са добавени 22 реда и са изтрити 12 реда
  1. 20
    12
      buildroot/share/git/mfpub
  2. 2
    0
      buildroot/share/git/mfup

+ 20
- 12
buildroot/share/git/mfpub Целия файл

@@ -35,7 +35,7 @@ fi
35 35
 echo "Stashing any changes to files..."
36 36
 echo "Don't forget to update and push 'master'!"
37 37
 # GOJF Card
38
-git stash
38
+[[ $(git stash) != "No local "* ]] && HAS_STASH=1
39 39
 
40 40
 COMMIT=$( git log --format="%H" -n 1 )
41 41
 
@@ -46,16 +46,26 @@ git clean -d -f
46 46
 if [[ $BRANCH == "master" ]]; then
47 47
 
48 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 70
 else
61 71
 
@@ -114,6 +124,4 @@ rm -rf ${TMPFOLDER}
114 124
 # Go back to the branch we started from
115 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 Целия файл

@@ -38,6 +38,8 @@ if [[ $BRANCH != $TARG ]]; then
38 38
   else
39 39
     echo "No such branch!"
40 40
   fi
41
+else
42
+  git reset --hard upstream/$TARG
41 43
 fi
42 44
 
43 45
 echo

Loading…
Отказ
Запис