From: Siraaj Khandkar Date: Sun, 15 Dec 2019 13:47:06 +0000 (-0500) Subject: Add script to push/pull .git/description X-Git-Url: https://git.xandkar.net/?a=commitdiff_plain;h=de5b7b0bea20c4df7f5f9a63e2b5fc5aaf8af149;p=khome.git Add script to push/pull .git/description --- diff --git a/home/bin/git-description b/home/bin/git-description new file mode 100755 index 0000000..710336b --- /dev/null +++ b/home/bin/git-description @@ -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