Say I have a file like the following:
/**
* A Test class
* @version 2011.11.24
*/
public class Test
{
}
I would like to have the date stamp automatically updated each time it gets committed to git and there has been a change in the file. Is this possible?
You could write a clean filter. This would actually occur when you add the files to the staging area, which could be even better (because to could see the result without commiting it).
Clean and smudge filters are described here: https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes#_keyword_expansion.
This page also contains an example of keyword expansion for
$Date$, using a small ruby script.