Avoid timestamps in git

How can you systematically install git to set all timestamps to some arbitrary point, for example. 1970-01-01 or something?

Are timestamps used, or are they just trivialities that can be anonymized?

+4
source share
1 answer

I really don’t know why this is necessary, but to create new commits with the commit and the author’s date set for this 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 overwrite all old dates in the repository, you can easily change the example here:

... rewrite each commit with these dates. Note that this will change the object name (SHA1sum) for each commit, of course.

As for whether dates are "trifles" - they, of course, are not for me! It is often useful to know when the commit was made, and not just its position in the commit graph. Also, less seriously, gource needs this data for its beautiful animation in the history of your repository;)

+9
source

Source: https://habr.com/ru/post/1344053/


All Articles