Alper
Alper

Reputation: 3953

How do I change the date of all commits in a branch to now?

In certain cases I may want to mask the exact date and time of work done and would like to reset the dates on a collection of work without throwing away the commit history as a whole.

How can I rewrite the dates on all commits?

Upvotes: 3

Views: 642

Answers (1)

Alper
Alper

Reputation: 3953

I looked around a bit and found nothing answering this exact question. The easiest solution seems to be:

git filter-branch -f --env-filter 'GIT_COMMITTER_DATE="`date`"; GIT_AUTHOR_DATE="`date`"'
git push -f origin master

Upvotes: 2

Related Questions