From mboxrd@z Thu Jan 1 00:00:00 1970 From: Benjamin Andresen Subject: Re: Keeping org files under git - trimming the repository Date: Tue, 04 Aug 2009 14:26:33 +0200 Message-ID: <87ws5jix3a.fsf@in-ulm.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MYJ6g-0002mX-Qh for emacs-orgmode@gnu.org; Tue, 04 Aug 2009 08:27:07 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MYJ6a-0002ja-Uy for emacs-orgmode@gnu.org; Tue, 04 Aug 2009 08:27:06 -0400 Received: from [199.232.76.173] (port=40905 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MYJ6a-0002jS-N3 for emacs-orgmode@gnu.org; Tue, 04 Aug 2009 08:27:00 -0400 Received: from mail.in-ulm.de ([217.10.8.10]:55170) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1MYJ6a-0004Y4-4F for emacs-orgmode@gnu.org; Tue, 04 Aug 2009 08:27:00 -0400 In-Reply-To: (Ben Alexander's message of "Tue, 4 Aug 2009 15:10:19 +0300") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: org-mode Mailinglist Hey Ben, Ben Alexander 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 | | WATCHDIR=~/Org | cd $WATCHDIR | | 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 HTH, benny