ソースを参照

Add git-sync script

Samuel W. Flint 5 年 前
コミット
f5e35da729
1 ファイル変更19 行追加0 行削除
  1. 19 0
      git-sync

+ 19 - 0
git-sync

@@ -0,0 +1,19 @@
+#!/bin/sh
+
+if ! GITDIR=$(git rev-parse --git-dir) ; then
+    echo "Not in a git repository" >&2
+    exit 0
+fi
+
+TREE=$(dirname $GITDIR)
+
+cd $TREE
+
+[ -e pre-sync ] && sh pre-sync
+git stash push -u -m "SYNC SAVE"
+git pull
+git push
+[ -e post-sync ] && sh post-sync
+if git stash list | grep "SYNC SAVE" >/dev/null ; then
+    git stash pop -q
+fi