From: dhruva Date: Mon, 10 Nov 2008 03:43:04 GMT Subject: Re: Something like $Id$, $Revision$ or $Date$? Message-ID: In-Reply-To: <87hc6gjs7v.fsf@erwin.mina86.com> Hi, On Mon, Nov 10, 2008 at 6:46 AM, Michal Nazarewicz wrote: > "Sverre Rabbelier" writes: > >> On Mon, Nov 10, 2008 at 01:22, Michal Nazarewicz wrote: >>> Now, what I need is such feature in GIT. Upon committing I would like >>> some magic string (say "$Date$") to be replaced with some value >>> identifying uniquely given version of a file (a date of the commit would >>> be sufficient). >> >> Please have a look at the relevant entry in the faq [0]. >> >> [0] http://git.or.cz/gitwiki/GitFaq#head-4a0afe71a2bb7734777a8b0b345e0308aefdbd40 > > Thanks for the quick reply (and yes, I can't believe I couldn't find > that myself...) but it still lacks one thing that I'd like to have. > I would like the "$Id$" sequences to be updated automatically after > a commit (ie. without the need to check out). (Besides I would prefer > $Date$ more but I can live with $Id$ I guess ;) ). I have worked on this topic quite a bit to fix issues in git-p4. There is no direct way to get this $Id$ expansion in git, however you can use a simple pre-commit hook (alpha state, more a proof of concept that happens to work for me) #!/usr/bin/env bash for file in `git diff-index --name-only --diff-filter=AM HEAD` ; do perl -pi -e 's/(\$[ \t]*Id)(.*)([ \t]*\$)/"\$Id: git ".time()." \$"/e' ${file} git add ${file} > /dev/null done -dhruva -- Contents reflect my personal views only!