At Thu, 25 Nov 2010 14:38:29 +0100, Rainer M Krug wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi > > I migrated from svn to git, but I have one problem: in some documents, I > used > src_emacs-lisp[:exports results]{(vc-working-revision (or > (buffer-file-name) org-current-export-file))} > to insert the revision of the document. In svn, this resulted in a > number, through which I could identify the revision and retrieve it from > svn when needed in the future. > Under git, it simply tells me "master" - is there anything I can do to > get something similar then the revision number in svn, which I can use > to retrieve the version from git? The problem is, that Git does not track revision of single files, but only the entire work dir. So from Git's point of view there is no such thing like a revision number of a particular file. You might use this function (defun my/git-last-commit-id () "Return last commit in current workdir." (let ((commit (shell-command-to-string "git log -1 --pretty=oneline"))) (when (stringp commit) (message (substring commit 0 40))))) To insert the ID of the last commit in the src_emacs_lisp[:exports results] line. Depending of the exact use of Git (e.g. explicitly committing changes vs. auto-commits via cron) using rcs (which supports file revision numbers) on top of Git. I do this for some files and have this in my .emacs.d/init.el: (setq vc-handled-backends (append (list 'RCS 'Git) (delq 'Git (delq 'RCS vc-handled-backends)))) What makes vc prefer RCS over Git, and Git over all other VCSs. So C-x v v by default uses RCS. HTH, -- David -- OpenPGP... 0x99ADB83B5A4478E6 Jabber.... dmjena@jabber.org Email..... dmaus@ictsoc.de