Will
Will

Reputation: 75615

avoid timestamps in git

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?

Upvotes: 4

Views: 326

Answers (1)

Mark Longair
Mark Longair

Reputation: 467013

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 ;)

Upvotes: 9

Related Questions