🔧 ProgrammierungRequest lifecycle: HandlerMapping HandlerAdapter resolvers(16.09.2026 um 00:08 Uhr)
🔧 ProgrammierungChapter 1 - The Funkiest of All Machines(16.09.2026 um 00:13 Uhr)
🔧 AI Nachrichten President Trump Called Nvidia’s Jensen Huang About A.I. Slowdown(15.09.2026 um 23:45 Uhr)
🔧 AI Nachrichten Google’s Simulated Fruit Fly Brain Did Not Write This Article(16.09.2026 um 00:00 Uhr)
🔧 ProgrammierungRequest lifecycle: HandlerMapping HandlerAdapter resolvers(16.09.2026 um 00:08 Uhr)
🔧 ProgrammierungChapter 1 - The Funkiest of All Machines(16.09.2026 um 00:13 Uhr)
🔧 AI Nachrichten President Trump Called Nvidia’s Jensen Huang About A.I. Slowdown(15.09.2026 um 23:45 Uhr)
🔧 AI Nachrichten Google’s Simulated Fruit Fly Brain Did Not Write This Article(16.09.2026 um 00:00 Uhr)

🔧 Programmierung 🕛 vor 2 Monaten 3 Min Lesezeit
0

Why Git Has Two Dates: Author Date vs Commit Date

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

Most developers assume a Git commit has a single timestamp.



That's not true.



Every commit actually contains two different dates:




  • Author Date

  • Commit Date



Most of the time they are identical, which is why many developers never notice the distinction.



But once you start rebasing, cherry-picking, or rewriting history, the difference becomes important.



Understanding these two timestamps can explain some very confusing Git and GitHub behavior.






Every Commit Contains More Metadata Than You Think



Let's inspect a commit:




CODE
git show --pretty=fuller HEAD






Example output:




CODE
commit 7fd2f85...

Author: John Doe
AuthorDate: Mon Jul 1 10:00:00 2026 +0000

Commit: John Doe
CommitDate: Thu Jul 10 18:42:00 2026 +0000






Notice that Git stores two separate timestamps.



Why?



Because they represent different events.






What Is Author Date?



The Author Date represents when the change was originally created.



Imagine this workflow:




CODE
July 1   Create commit
July 5 Open pull request
July 10 Rebase branch






The code was written on July 1.



That's the Author Date.



It answers the question:




When was this work originally authored?







What Is Commit Date?



The Commit Date represents when the current commit object was created.



This is where many developers get surprised.



When Git rewrites history, it creates completely new commit objects.



For example:




CODE
git commit --amend






or




CODE
git rebase -i






Both operations generate new commits.



As a result, the Commit Date changes.



It answers the question:




When was this version of the commit created?







Why The Dates Become Different



Let's take a simple example.



You create a commit:




CODE
July 1






A week later you perform an interactive rebase:




CODE
July 8






Result:




CODE
AuthorDate = July 1
CommitDate = July 8






Nothing is wrong.



Git is preserving the original creation time while also recording when the rewritten commit object appeared.






Why GitHub Sometimes Looks Wrong



Many developers first encounter this distinction on GitHub.



You've probably seen something like:




CODE
Commit created: July 1
Displayed on GitHub: July 8






and wondered:




Why did GitHub change my commit date?




Usually GitHub isn't wrong.



It's simply displaying metadata that changed after a rebase, cherry-pick, or amend operation.



Understanding Author Date and Commit Date immediately explains this behavior.






Changing Commit Dates



Changing the latest commit date is relatively straightforward.




CODE
GIT_COMMITTER_DATE="$(date)" \
git commit --amend --no-edit --date "$(date)"






Changing older commits is significantly more annoying.



You typically need:




CODE
git rebase -i






followed by manual date editing and history rewriting.



This becomes painful when multiple commits are involved.






Why Commit Hashes Change



Another common surprise:



Changing only the timestamp changes the commit hash.



Many developers expect the hash to stay the same because the code didn't change.



But Git hashes the entire commit object, including metadata.



That means:




CODE
Same code
Same files
Same message
Different timestamp






results in:




CODE
Different commit hash






This is expected behavior.






When Would You Change Commit Dates?



There are legitimate reasons:




  • Fixing incorrect system clocks

  • Repository migrations

  • Cleaning imported history

  • Reconstructing chronological order

  • Educational demonstrations

  • Privacy reasons



In most cases you should avoid rewriting public history, but for personal branches and local repositories it can be useful.






Final Thoughts



Git stores two timestamps because they answer two different questions:



Author Date




When was this work originally created?




Commit Date




When was this commit object created?




Once you understand the distinction, many confusing Git and GitHub behaviors suddenly make sense.



While researching Git timestamps, I ended up building a small tool called GitEditDate that makes editing commit dates easier without manually wrestling with complex rebase commands.



Until then, I had no idea how much metadata was hiding inside a simple Git commit.

Vollständiger Original-Artikel
Den kompletten Beitrag mit allen Details direkt auf dev.to lesen.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
Protect Kubernetes Services with OAuth2 Proxy, Gateway API, Traefik, and Pocket ID
1 Quelle
Request lifecycle: HandlerMapping HandlerAdapter resolvers
1 Quelle
The best n8n fix I found this month was boring: lower your agent concurrency settings before touching the prompt
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Why Git Has Two Dates: Author Date vs Commit Date

Thematisch verwandte Begriffe: Dates, Author, Date, Commit · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...