From 33f8a5610953eb3eb91bb0df4e152f6da8824b45 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Sun, 16 Aug 2015 00:09:50 -0700 Subject: [PATCH] git-sync/org-sync --- dotfiles/lib/shellenv/git-sync.sh | 13 ++++++++++++ .../LaunchAgents/org.imalison.org-sync.plist | 20 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 dotfiles/lib/shellenv/git-sync.sh create mode 100644 resources/LaunchAgents/org.imalison.org-sync.plist diff --git a/dotfiles/lib/shellenv/git-sync.sh b/dotfiles/lib/shellenv/git-sync.sh new file mode 100644 index 00000000..2a6494cf --- /dev/null +++ b/dotfiles/lib/shellenv/git-sync.sh @@ -0,0 +1,13 @@ +function git-sync { + local target="$1" + local destination="$2" + cd "$destination" + git fetch origin + # This won't work for branches other than master + git rebase origin/master + + rsync -t $target/* $destination + git commit -am "$(date)" + git push origin HEAD + git clean -fd +} diff --git a/resources/LaunchAgents/org.imalison.org-sync.plist b/resources/LaunchAgents/org.imalison.org-sync.plist new file mode 100644 index 00000000..c24a2496 --- /dev/null +++ b/resources/LaunchAgents/org.imalison.org-sync.plist @@ -0,0 +1,20 @@ + + + + + Label + org.imalison.org-sync + ProgramArguments + + zsh + -c + ~/org-sync.sh + + StartInterval + 60 + StandardOutPath + /tmp/org.imalison.org-sync.out + StandardErrorPath + /tmp/org.imalison.org-sync.error + +