If you've already made a local commit, but want to backdate it (change author and committer time), you can do it with git commit --amend using environment variables.
-
Set the desired date and timezone:
export GIT_AUTHOR_DATE="2025-05-20T08:30:00+0300" export GIT_COMMITTER_DATE="2025-05-20T08:30:00+0300"
-
Amend the commit:
git commit --amend --no-edit --date "$GIT_AUTHOR_DATE" -
Clear the variables (optional):
unset GIT_AUTHOR_DATE unset GIT_COMMITTER_DATE
export GIT_AUTHOR_DATE="2025-05-20T07:50:00+0300"
export GIT_COMMITTER_DATE="2025-05-20T07:50:00+0300"
git commit --amend --no-edit --date "$GIT_AUTHOR_DATE"
unset GIT_AUTHOR_DATE
unset GIT_COMMITTER_DATEIf the commit has already been pushed, rewriting history will require a forced push:
git push --forceBe careful when working in shared branches.