Add script to push/pull .git/description
authorSiraaj Khandkar <siraaj@khandkar.net>
Sun, 15 Dec 2019 13:47:06 +0000 (08:47 -0500)
committerSiraaj Khandkar <siraaj@khandkar.net>
Sun, 15 Dec 2019 13:47:06 +0000 (08:47 -0500)
home/bin/git-description [new file with mode: 0755]

diff --git a/home/bin/git-description b/home/bin/git-description
new file mode 100755 (executable)
index 0000000..710336b
--- /dev/null
@@ -0,0 +1,31 @@
+#! /bin/sh
+
+set -e
+
+exe="$0"
+cmd="$1"
+remote="$2"
+
+usage() {
+    printf "Usage: %s [push|pull] REMOTE\n" "$exe"
+    exit 1
+}
+
+case "$cmd" in
+    push | pull) ;;
+    *) usage ;;
+esac
+
+case "$remote" in
+    '') usage ;;
+    *) ;;
+esac
+
+remote_url=$(git remote get-url "$remote")
+remote_file="${remote_url}/description"
+local_file='.git/description'
+
+case "$cmd" in
+    push) scp "$local_file" "$remote_file";;
+    pull) scp "$remote_file" "$local_file";;
+esac
This page took 0.036504 seconds and 4 git commands to generate.