How do I enable ident $Id$ on files in a Git repository?
+2
A:
You can do this by adding a pattern for which files you want this functionality followed by ident
in the .gitattributes
file. This will replace $Id$ with $Id:<40-digit SHA>$ on checkout of the file. Notice though that it won't give you a revision number of the file as in CVS/SVN.
Example:
$ echo '*.txt ident' >> .gitattributes
$ echo '$Id$' > test.txt
$ git commit -a -m "test"
$ rm test.txt
$ git checkout -- test.txt
$ cat test.txt
Link to gitattributes(5) Manual Page
m5h
2009-11-24 21:04:55
I just played around with this and as far as I can tell this gives only a SHA for a specific file, not an $Id$ for the entire repository.
Aaron
2009-11-24 21:23:33