Is there a hook which updates $Id$ in files on clone/pull?
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-开发者_如何学Cof-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.
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:
- https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes#_keyword_expansion
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.
精彩评论