[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] Re: Keeping org files under git - trimming the repository

From: Benjamin Andresen
Subject: [Orgmode] Re: Keeping org files under git - trimming the repository
Date: Tue, 04 Aug 2009 14:26:33 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

Hey Ben,

Ben Alexander <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]