Preserving timestamps with git

Jakob Voss jakob.voss at
Thu May 27 17:44:31 CEST 2010

On 27.05.2010 13:26, martin f krafft wrote:

>> But git-utime is only one side of the process. How do I
>> 1) reset the commit time of selected files in the repository to their
>> last modification timestamp (for the files that I have already
>> commited)
> man touch

I thought about rewriting the history so I would be something with 'git 
filter-branch' if this can also split one commit with N files into N 
commits with one commit for each file.

>> 2) add and commit a set of files in a batch such that each commit has
>> the timestamp of the last modification time of its file (for new
>> files).
> man git-commit

I found the --date parameter and read more about it. I think I need a 
kind of "git-import-files" script that imports files just like you can 
import other repositories (SVN, CVS...).

>> How do you deal with timestamp of you files? I heard there are
>> some hacks to even preserve file permissions but I'd prefer
>> a simple solution first.
> Well, I'd suggest you don't reinvent the wheel and instead use
> metastore:
> It doesn't force you to do one-commit-per-file, but instead just
> saves and restores the metadata separately.

Thanks, this will be helpful for special repositories that need to 
preserve file permissions. But as long as I use git for replication I 
prefer to have the timestamp metadata directly in the commit as if I 
would commit everytime I changed a file. It's a pitty that there is no 
good versioning file system for Linux yet.


Jakob Voß <jakob.voss at>, skype: nichtich
Verbundzentrale des GBV (VZG) / Common Library Network
Platz der Goettinger Sieben 1, 37073 Göttingen, Germany
+49 (0)551 39-10242,

More information about the vcs-home mailing list