On 2016-01-01 at 05:02, Alan Schmitt <alan.schm...@polytechnique.org> wrote: > Hello Ken, >> >> On my system this is a git repository and a cron (or actually >> LaunchAgent since I'm on OS X) does a =git commit -a >> <date-time-stamp>= every night. > > I'm very interested about this. Could you please share your LaunchAgent > configuration file?
I miss the simpler days of cron, but when in Rome or on OS X... The following is ~/Library/LaunchAgents/com.kenmankoff.orggit.plist <?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>com.kenmankoff.orggit</string> <key>ProgramArguments</key> <array> <string>/Users/mankoff/bin/orggitcommit.sh</string> </array> <key>RunAtLoad</key> <true/> <key>StartInterval</key> <integer>86400</integer> </dict> </plist> Which runs the following shell script: #!/usr/bin/env bash cd ~/Documents/Org/ /usr/local/bin/git commit -a -m "`/bin/date +%Y-%m-%d\ %T`" Run the following 1x: cd ~/Library/LaunchAgents/ launchctl load com.kenmankoff.orggit Then in my Org folder, =git lg= (aliased to git log --graph --pretty=format:'%C(red)%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ad)' --abbrev-commit --date=short) shows: * 926cfa9 - 2015-12-30 12:51:55 (2015-12-30) * cac0191 - 2015-12-22 08:53:39 (2015-12-22) * be839e2 - 2015-12-20 01:32:03 (2015-12-20) * 9a68231 - 2015-12-17 09:26:40 (2015-12-17) * 9782112 - 2015-12-16 09:26:36 (2015-12-16) * d7df50c - 2015-12-15 21:27:53 (2015-12-15) * 635a0fa - 2015-12-15 17:41:55 (2015-12-15) * 72cafc1 - 2015-12-14 11:08:48 (2015-12-14) So you can see things get checked in to git about once every few days, unless my laptop is closed a lot like it just was over the holidays. If you wanted more frequent commits, LaunchAgents can run every time a file in a folder is saved. If that is too often, a middle ground could be to run the bash script every time a file is saved, but have that script only do the commit if it has been >12 or >24 hours, using the "find -newer" command, for example. Or only if >n lines have changed (from git diff). -k.