Suppose you commit a fix on Monday and a maintainer cherry-picks it onto a release branch on Friday. The commit on the release branch normally shows Monday as its author date, when you originally recorded the change, and Friday as its committer date, when the maintainer created this copy. Run this command to see both timestamps on the latest commit.
git log -1 --format=fuller
How do I change just one date on the latest commit?
Git labels the two fields AuthorDate and CommitDate. As the manual puts it, --date will “Override the author date used in the commit.”1 An amend normally gives the replacement commit the current committer date. Start with a clean staging area so you don’t accidentally include file changes.
To change only AuthorDate, read the existing committer date with %cI (ISO 8601, including the time zone) and pass it back to Git during the amend.
GIT_COMMITTER_DATE="$(git show -s --format=%cI HEAD)" \
git commit --amend --no-edit --date="2025-05-05T09:30:00+08:00"
To change only CommitDate, set GIT_COMMITTER_DATE for this command. An ordinary amend carries the author and author date forward.2
GIT_COMMITTER_DATE="2025-05-07T16:00:00+08:00" git commit --amend --no-edit
To set both dates explicitly, use the second command and add --date="2025-05-05T09:30:00+08:00". Run git log -1 --format=fuller again to check both values.
What if the commit is further back?
On a branch with linear history, run git rebase -i abc1234^, replacing abc1234 with the target commit’s hash. The caret selects the target’s parent, so the list of commits to replay starts with the target itself. For the first commit in the repository, use git rebase -i --root.3
Change pick to edit on the target line and save. When Git pauses, run the amend command you need, check both dates, then run git rebase --continue. Changing a timestamp gives the commit a new hash. Each replayed descendant also gets a new hash because its parent changed, and normally gets a fresh committer date. Coordinate with collaborators before rewriting a shared branch.
Footnotes
-
Git Project. (n.d.). git-commit, Options,
--date=<date>. Git Documentation. Option description. ↩ -
Pladijs, P. (2011, February 16). Answer to How can one change the timestamp of an old commit in Git? Stack Overflow. Answer with separate author and committer date examples. ↩
-
Git Project. (n.d.). git-rebase, Interactive mode. Git Documentation. Editing a commit during a rebase. ↩