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

Viewed 99

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?

1 Answers

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
Related