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 + +