]> git.cworth.org Git - nogit/blobdiff - nogit
Provide a simple implementation of "nogit sync"
[nogit] / nogit
diff --git a/nogit b/nogit
index b9a248e3f638ad9e2a203a1b8f77dd47601b4454..212ca33094e7c0af1f4fac7070747dab96f2a14c 100755 (executable)
--- a/nogit
+++ b/nogit
@@ -103,7 +103,17 @@ nogit_clone()
 
 nogit_sync()
 {
-    echo "Internal error: 'nogit sync' not yet implemented"
+    # First commit any locally modified nogit files
+    GIT_DIR=$NOGIT_DIR git commit -a -m "nogit-sync commit" >/dev/null 2>&1 || true
+
+    # Then, fetch and merge any upstream changes
+    GIT_DIR=$NOGIT_DIR git fetch >/dev/null 2>&1
+    GIT_DIR=$NOGIT_DIR git merge -m "nogit-sync merge" >/dev/null 2>&1
+
+    # Finally, push any new commits up to the upstream repository
+    GIT_DIR=$NOGIT_DIR git push >/dev/null 2>&1
+
+    echo "Completed nogit sync"
 }
 
 if [ $# -lt 1 ]; then