Is there a hook which updates $Id$ in files on clone/pull?

619 Views Asked by At

I have a bare (remote) GIT repository with the several users blessed to commit there. On repository clone/pull I want that each source file which contains magic $Id:$ is expanded to smth. like: $Id: <name-of-last-committer> <data>.

It'd be amazing if this expanded/collapsed magic string would not affect on file modification state.

I suppose it is done via hooks. I wonder if there are any ready-to-use such hooks? Or how my task with $Id can be solved? Thanks.

2

There are 2 best solutions below

2
On BEST ANSWER

You should take a look at the section of Pro Git on keyword expansion - I'm sure you can adapt that solution to your needs:

0
On

I use the pre-commit script to alter the $Id:$ tag. It fills out the whole thing with current information. As for the version number, all I do is add one to it. So 1.012 becomes 1.013. The current time and date as well as the current user are added to the tag.