How to make a Git commit with a Custom Date

Configurare noua (How To)

Situatie

Backdating a Bug Fix for a Report

You’re a developer working on a software project with a small team. Your manager asks you to prepare a changelog and a bug-fix report for an upcoming release. As you go through the Git history, you realize that you fixed a critical bug two weeks ago, but completely forgot to commit the change at that time.

The problem?

The changelog must reflect when the bug was actually fixed, not when you’re committing it now. This matters because:

• QA tested the fix around that time.

• The release notes must be accurate.

• The manager wants all records to reflect the real workflow for compliance purposes.

Solutie

GIT_COMMITTER_DATE=”Thu 24 Apr 2025 18:19:19 UTC” git commit -m “Backdated Commit” –date “Thu 24 Apr 2025 18:19:19 UTC”

Author Date

The date the code was originally written or conceived.

• It reflects when the person authored the change — basically when the idea or the fix was made.

• You can set this to an earlier date if you forgot to commit something on time.

Committer Date

The date the code was actually committed into the repository.

• This is the time when someone (not necessarily the author!) ran git commit.

• If someone cherry-picks, rebases, or amends a commit, the committer date changes, but the author date stays the same.

Tip solutie

Permanent

Voteaza

(3 din 5 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?