emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ken Mankoff <mankoff@gmail.com>
To: Alan Schmitt <alan.schmitt@polytechnique.org>
Cc: orgmode list <emacs-orgmode@gnu.org>, Tyler Smith <tyler@plantarum.ca>
Subject: Re: org files and projects nested git repositories
Date: Fri, 01 Jan 2016 07:33:47 -0500	[thread overview]
Message-ID: <m260zd8ono.fsf@gmail.com> (raw)
In-Reply-To: <m2y4c9lisb.fsf@polytechnique.org>


On 2016-01-01 at 05:02, Alan Schmitt <alan.schmitt@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.

  reply	other threads:[~2016-01-01 12:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-31 17:38 org files and projects nested git repositories Tyler Smith
2015-12-31 18:01 ` Ken Mankoff
2015-12-31 18:33   ` Tyler Smith
2015-12-31 18:42     ` Mike McLean
2016-01-01 10:02   ` Alan Schmitt
2016-01-01 12:33     ` Ken Mankoff [this message]
2016-01-04 13:04       ` Alan Schmitt
2015-12-31 18:20 ` Kyle Meyer
2015-12-31 18:38   ` Tyler Smith
2015-12-31 18:53     ` Brenda Butler
2015-12-31 19:00       ` Tyler Smith
2015-12-31 18:55     ` Kyle Meyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m260zd8ono.fsf@gmail.com \
    --to=mankoff@gmail.com \
    --cc=alan.schmitt@polytechnique.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=tyler@plantarum.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).