Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


git filter to change committer date in version info file.

via git hook

with you can update a date in python files. copy the script to .git/hooks/pre-commit and make is executable.

The hook will only change files and the date in this format:

__version__ = (xx, yy, zz, 120726)

(where xx, yy, zz you own version numbers)

via .gitattributes filter

store a copy of into $PATH:

$ cd ~/bin # or e.g.: /user/local/bin
~/bin$ wget
~/bin$ chmod +x

add to git config:

$ git config --global filter.dater.smudge " smudge"
$ git config --global filter.dater.clean " clean"

add files, e.g:

$ echo 'commit_date="$Date$" # set by .gitattributes filter >
$ echo ' filter=dater' >> .gitattributes
$ git add .gitattributes

Note: the date exist only after you have deleted and checkout the file again, e.g.:

$ git commit -m "test .gitattributes filter"
$ cat # see old, unchanged content:
commit_date="$Date$" # set by .gitattributes filter
$ rm
$ git checkout
$ cat # now the date is inserted:
commit_date="$date:0725$" # set by .gitattributes filter


Note: Every guy which clone your git repro and doesn't have this filter installed, will get a clean date!

to check if it's callable just do call it without any parameter (You will the a error message), e.g.:


The script is callable if you get this error message:

Error: missing commandline parameters smudge or clean!

To test if the git commit date would be used do this:

$ cd /your/repo/
/your/repo/$ git log --pretty=format:%ci -1 HEAD
2012-07-25 11:41:47 +0200
/your/repo/$ echo '$date$' | smudge

to check if it's in git config, run this:

$ git config --list
... smudge clean


more info: