From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernt Hansen Subject: Re: Keeping your history for org files Date: Sat, 15 Nov 2008 13:32:52 -0500 Message-ID: <878wrkj0vf.fsf@gollum.intra.norang.ca> References: <87tzilzgkv.fsf@gollum.intra.norang.ca> <47F37096.3080705@diplan.de> 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 1L1Px3-0005p7-30 for emacs-orgmode@gnu.org; Sat, 15 Nov 2008 13:32:57 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L1Px2-0005oJ-DG for emacs-orgmode@gnu.org; Sat, 15 Nov 2008 13:32:56 -0500 Received: from [199.232.76.173] (port=59866 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L1Px2-0005oC-6h for emacs-orgmode@gnu.org; Sat, 15 Nov 2008 13:32:56 -0500 Received: from mho-02-bos.mailhop.org ([63.208.196.179]:50709) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L1Px1-0004N8-S7 for emacs-orgmode@gnu.org; Sat, 15 Nov 2008 13:32:55 -0500 In-Reply-To: (Peter BARABAS's message of "Sat\, 15 Nov 2008 16\:51\:45 +0000 \(UTC\)") 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: Peter BARABAS Cc: emacs-orgmode@gnu.org Peter BARABAS writes: > Rainer Stengele diplan.de> writes: > > Hello, > > >> > >> > ------------------------------------------------------------------------ >> > * Creating commits automatically >> > ------------------------------------------------------------------------ >> > >> > Then I added a cron job on my workstation which commits changes to the >> > repository automagically. I decided commits once per hour is enough for >> > me so I added the following crontab entry: >> > >> > $ crontab -e >> > >> > ,----[ My crontab entry ] >> > | 0 * * * * cd ~/git/org && git add . && git commit -m "$(date)" >/dev/null >> > `---- >> > >> > and I'm done. This picks up all my .org and .org_archive files and >> > tracks changes hourly. >> > >> > If I change a file a new commit gets created on the next hour. If >> > nothing changes no commit is created since there is nothing to add. >> > > > I'm using a similar setup, but with a hook: > > (defun git-commit () > (when (eq major-mode 'org-mode) > (shell-command "git commit -a -m 'Auto commit.'"))) > > (add-hook 'after-save-hook 'git-commit) > > This way, after I save the file it gets commited. And I'm using a similar setup to the hourly commit cron job of Rainer's but with the following script so it removes deleted files too. This works over multiple org repositories. ,----[ org-git-sync.sh ] | #!/bin/sh | # Add org file changes to the repository | REPOS="org doc.norang.ca www.norang.ca" | | for REPO in $REPOS | do | echo "Repository: $REPO" | cd ~/git/$REPO | # Remove deleted files | git ls-files --deleted -z | xargs -0 git rm >/dev/null 2>&1 | # Add new files | git add . >/dev/null 2>&1 | git commit -m "$(date)" | done `---- ,----[ crontab entry ] | 0 * * * * ~/bin/org-git-sync.sh >/dev/null `---- If I want to manually update I just run the org-git-sync.sh script at the shell prompt. Usually I do that when moving files to/from my laptop - so I commit all the changes to the repos and then push/pull the commits. I've also added a .gitignore file to skip files created by exporting ,----[ .gitignore ] | *.html | *~ | .#* | \#*\# | *.txt | *.tex | *.aux | *.dvi | *.log | *.out | *.ics | *.pdf `---- so files created by exporting are not automatically added to the repo. I can still explicitly add .pdf files as attachments if necessary so that they become tracked. -Bernt