4

How can you systematically set git up to set all timestamps to be at some arbitrary point e.g. 1970-01-01 or something?

Are timestamps ever used, or are they just trivia that it is safe to anonymize?

Will
  • 73,905
  • 40
  • 169
  • 246

1 Answers1

9

I really have no idea why one would want to do this, but for creating new commits with commit and author date set to that date and time, you can do:

export GIT_AUTHOR_DATE="1970-01-01T00:00:00"
export GIT_COMMITTER_DATE="1970-01-01T00:00:00"

To rewrite all the old dates in the repository you can easily modify the example here:

... to rewrite every commit with those dates. Note that this will change the object name (SHA1sum) of every commit, of course.

As for whether the dates are "trivia" - they certainly aren't to me! It's frequently useful to know when a commit was made, and not just its position in the commit graph. Also, less seriously, gource needs those data for its beautiful animations of your repository history ;)

Community
  • 1
  • 1
Mark Longair
  • 446,582
  • 72
  • 411
  • 327