开发者

avoid timestamps in git

How can you systematically set git up to set all timesta开发者_JAVA技巧mps 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?


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:

  • How can one change the timestamp of an old commit in Git?

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜