git commit custom timestamp
tl;dr
GIT_AUTHOR_DATE="2024-07-01T15:30:00Z" GIT_COMMITTER_DATE="2024-07-01T15:30:00Z" git commit -m 'in the past'
Explanation
It's not enough to set the commit date, you have to set the author date as well. I also find that it's more believable to use non-zero seconds values, such as:
GIT_AUTHOR_DATE="$( date -d "now - 2 hours" )" GIT_COMMITTER_DATE="$( date -d "now - 2 hours" )" git commit -m 'before the deadline, see the commit timestamp?'
References
This page has way more info about how to do this to multiple commits, such as modifying the entire history of a branch.
Comments