git-sync/org-sync

This commit is contained in:
Ivan Malison 2015-08-16 00:09:50 -07:00
parent f9724a16a5
commit 33f8a56109
2 changed files with 33 additions and 0 deletions

View File

@ -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
}

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.imalison.org-sync</string>
<key>ProgramArguments</key>
<array>
<string>zsh</string>
<string>-c</string>
<string>~/org-sync.sh</string>
</array>
<key>StartInterval</key>
<integer>60</integer>
<key>StandardOutPath</key>
<string>/tmp/org.imalison.org-sync.out</string>
<key>StandardErrorPath</key>
<string>/tmp/org.imalison.org-sync.error</string>
</dict>
</plist>