emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Benjamin Andresen <benny@in-ulm.de>
To: org-mode Mailinglist <emacs-orgmode@gnu.org>
Subject: Re: Keeping org files under git - trimming the repository
Date: Tue, 04 Aug 2009 14:26:33 +0200	[thread overview]
Message-ID: <87ws5jix3a.fsf@in-ulm.de> (raw)
In-Reply-To: <BF2B7F9E-FAD4-4A29-AF1B-8FBB0E14AF00@alexanderonline.org> (Ben Alexander's message of "Tue, 4 Aug 2009 15:10:19 +0300")

Hey Ben,

Ben Alexander <bva@alexanderonline.org> writes:

>  Different people cite different benefits:
> + safety while editing. If a slip of the fingers hits C-k on a folded
> line and you don't notice it for a long time, git allows you to find
> when that happen (git blame) and 'cherry-pick' a patch to bring the
> lost subtree forward in time.

That's the reason I do it.

I have my main laptop where I spend 90% of my time on so syncing is not
the issue for me.

>  I added a hook to auto commit every time I saved any org file. My
> simple, small text file of todo items is now a giant git repository.
> At last a question or two: Does this happen to you? What do you do?
> What new git command do I need to learn in order to do it?

I don't quite understand the first question. But I give a shot on the
second question (Hopefully I understood it correctly.):

My setup is that I keep my org files in ~/Org, I then launch a script at
the start of my login session that automatically commits every change
done to a ".org*" file. (Everything else is git-ignored.)

This is the file that does all the magic. ;-)
,----[ org-autocommitd ]
| #!/bin/zsh
| inotifywait -m --format '%f' -e close_write $WATCHDIR | \
| while read file; do
|   git add --all
|   git commit --all --message="${file} was saved"
| done

The idea behind doing this instead of using emacs to auto-save, was so
that when I used other tools than emacs to edit that directory, the
changes would still be saved.
I don't actually do that currently, but the idea of having it tool
agnostic seemed like a good idea at the time.

> -Ben


  reply	other threads:[~2009-08-04 12:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-04 12:10 Keeping org files under git - trimming the repository Ben Alexander
2009-08-04 12:26 ` Benjamin Andresen [this message]
2009-08-04 13:31 ` Matt Lundin
2009-08-05  6:18 ` Ian Barton
2009-08-05  6:53 ` Torsten Wagner

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:

  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=87ws5jix3a.fsf@in-ulm.de \
    --to=benny@in-ulm.de \
    --cc=emacs-orgmode@gnu.org \


* 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


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).