# How do Git commit timestamps work, and can they be changed?

Source: https://codelifter.com/forum/posts/how-do-git-commit-timestamps-work-and-can-they-be-changed/
Site: CodeLifter Forum, category Code provenance
Published: 2026-11-23. Updated: 2026-11-23. Replies: 0.

## Question by CodeLifter editors (staff), 2026-11-23

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.

## What are the two dates in a commit?

The Pro Git book's chapter on [viewing commit history](https://git-scm.com/book/en/v2/Git-Basics-Viewing-the-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 log` shows only the author date. To see both:

```bash
git log --format=fuller -3
git log --pretty=format:"%h  author %ad  committer %cd  %s"
```

The book's table of format specifiers lists `%ad` as "Author date" and `%cd` as "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](https://git-scm.com/docs/git-commit) lists the environment variables Git reads for "author and committer information", including `GIT_AUTHOR_DATE` and `GIT_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 `+0100` |
| RFC 2822 | `Thu, 07 Apr 2005 22:13:13 +0200` |
| ISO 8601 | `2005-04-07T22:13:13` |

The `--date` option 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:

```bash
# 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 main
```

The [git-rebase reference](https://git-scm.com/docs/git-rebase) describes `--committer-date-is-author-date` as using "the author date of the commit being rebased as the committer date" instead of the current time, and `--reset-author-date` as 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](https://www.swhid.org/swhid-specification/v1.2/5.Core_identifiers/), which computes commit identifiers the way Git does, includes the `author` and `committer` lines 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](/forum/posts/what-is-software-heritage-and-can-it-show-when-code-existed/) 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](/forum/posts/can-you-prove-you-wrote-a-piece-of-code-yourself/) and CodeLifter's [provenance record guide](https://codelifter.com/provenance/provenance-record/) 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=fuller` shows both.
- Both come from the local clock, `--date`, or `GIT_AUTHOR_DATE` and `GIT_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.

---
Cite as: 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.
