How do Git commit timestamps work, and can they be changed?
Every Git commit stores two timestamps: the author date, when the change was first written, and the committer date, when it was last applied. Both come from the committing machine's clock or from options and environment variables, so yes, they can be changed. That is why a commit date alone never proves when code was written.
Cite
CodeLifter Forum, "How do Git commit timestamps work, and can they be changed?", https://codelifter.com/forum/posts/how-do-git-commit-timestamps-work-and-can-they-be-changed/, accessed 2026-11-23.- CodeLifter editorsStaffStaff, CodeLifter ·
What are the two dates in a commit?
The Pro Git book's chapter on viewing commit history explains the split: "The author is the person who originally wrote the work, whereas the committer is the person who last applied the work." Each role has its own date. When you commit your own work, both dates are the same moment. They drift apart when a commit is rewritten: an amend, a rebase or a cherry-pick keeps the author date and sets a new committer date.
Plain
git logshows only the author date. To see both:git log --format=fuller -3 git log --pretty=format:"%h author %ad committer %cd %s"The book's table of format specifiers lists
%adas "Author date" and%cdas "Committer date". If the two differ by months on a commit, it was rewritten later; that is normal after a rebase and is worth knowing before you read anything into the date.Where does Git get the time from?
From the computer making the commit, unless told otherwise. The git-commit reference lists the environment variables Git reads for "author and committer information", including
GIT_AUTHOR_DATEandGIT_COMMITTER_DATE, and its DATE FORMATS section says they accept three formats:Format Example from the docs Git internal format A Unix timestamp plus a UTC offset, such as +0100RFC 2822 Thu, 07 Apr 2005 22:13:13 +0200ISO 8601 2005-04-07T22:13:13The
--dateoption goes further and "will also try to make sense of other, more human-centric date formats, such as relative dates like 'yesterday'". Nothing checks these values against a trusted clock. A laptop with the wrong time zone or a dead clock battery writes the wrong date, and so does anyone who sets the variables deliberately.When is changing a date legitimate?
Several ordinary situations call for it:
- The clock was wrong. A new machine or virtual machine committed with a date years out.
- You are importing history. Converting an old project from another version control system, where you want commits to carry their original dates.
- You rebased and want the dates to stay meaningful. By default a rebase sets every committer date to now.
The commands, all from the official reference pages:
# Fix the author date on the last commit (committer date becomes now) git commit --amend --no-edit --date="2026-11-20T09:15:00" # Set both dates on the last commit GIT_COMMITTER_DATE="2026-11-20T09:15:00" git commit --amend --no-edit --date="2026-11-20T09:15:00" # Rebase, keeping each commit's author date as its committer date git rebase --committer-date-is-author-date main # Rebase, stamping the current time as the author date instead git rebase --reset-author-date mainThe git-rebase reference describes
--committer-date-is-author-dateas using "the author date of the commit being rebased as the committer date" instead of the current time, and--reset-author-dateas using "the current time as the author date". The git-commit page notes that--reset-author, used with--amend, also "renews the author timestamp".What happens when you change one?
You create a different commit. The timestamps are part of what gets hashed: the SWHID specification, which computes commit identifiers the way Git does, includes the
authorandcommitterlines with their timestamps in the bytes that are hashed. Change a date and the commit hash changes, and so does every later commit that descends from it. If the commits were already pushed, other people's copies now disagree with yours, and publishing the change means a force push. Do it on shared branches only with agreement.Changing dates to make work look older or newer than it is, for a deadline, a dispute or a credit claim, is misrepresentation, whatever the tool allows. The honest fix for a wrong date is to correct it and say so in the commit message or pull request.
Can anything show the real date?
Not the commit itself. Evidence comes from records made by someone other than the committer:
- Archive captures. The Software Heritage thread explains how an archive visit records that code existed by a date.
- Hosting records. Pull requests, reviews and continuous integration runs carry the server's timestamps, not yours.
- Signed releases and published packages, which are fixed once others have downloaded them.
The seed thread on proving you wrote code and CodeLifter's provenance record guide cover how to combine those into something a reviewer can check.
Checked on 12 November 2026.
Short version
- Each commit has an author date and a committer date;
git log --format=fullershows both. - Both come from the local clock,
--date, orGIT_AUTHOR_DATEandGIT_COMMITTER_DATE. - Rebasing resets committer dates unless you pass
--committer-date-is-author-date. - Changing a date rewrites the commit and every commit after it.
- For evidence of timing, use records made by a third party, not the commit date.
Write something first.
Give people something to work with: at least 30 words on what happened and what you tried.
That is too long. Keep it under 6,000 characters.
Write the question as the title, 15 to 140 characters, no links.
Pick a category.
Add a name (2 to 40 characters, no links).
That email address does not look right.
That was quick. Read the thread, then try again.
The form expired. Reload the page and post again.
Something went wrong with the form. Reload and try again.
Please complete the check and post again.
Limit reached for now. Try again later.
This thread is closed to new replies.
This thread no longer accepts replies.
Something went wrong with the form. Reload and try again.
Post a reply or question first (name and email), then this browser can vote, edit and accept answers.
You cannot vote on your own post.
Only the author (within 30 days) or the forum team can do that.
That email already has an account. Use your sign-in link instead.
New accounts are paused for the moment. Try again later.
That was already posted.