2

I have a project of which I have about 6 backup folders, each named after the date of the backup. I am moving these to a Git system, and I want to preserve the date/time the files inside were created. I do not want to use one date for all files in each backup (as I have seen in other SO questions), and I do not intend to use filesystem dating moving forward, as that would break tools like make etc. I would like to "bring git up to speed" as it were, by committing each of these backup folders using the filesystem creation date of each file as the author date, and the last modified as the commit date. This is a one time process that I will repeat 6 times, after which I will commit normally. Is there a way to do this? I'm really trying to preserve the code timeline. Thanks!

selkathguy
  • 1,171
  • 7
  • 17

1 Answers1

1

Rather than trying to set the right date for each and every file (which would mean one commit per file), you could record those dates in a file, and have a post-checkout hook able to restore those dates.

See "What's the equivalent of use-commit-times for git?" for an example of such a script, which will store mtimes in a .mtimes file in git repository, and restore those mtimes on checkout.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250