0

I did git commit --amend --reset-author and it reset the timestamp to today.

Is there a way to recover the original timestamp? I.e.,

  1. Find out what it was (git reflog --pretty shows it, as suggested by @evolutionxbox in a comment)
  2. Edit the commit and modify the timestamp
sds
  • 58,617
  • 29
  • 161
  • 278
  • `git reflog` might be able to tell you what the old commit was. – evolutionxbox Feb 22 '22 at 16:51
  • @evolutionxbox: thanks, that solves the 1st problem; now, what about the 2nd one? – sds Feb 22 '22 at 17:00
  • https://git-scm.com/docs/git-commit#Documentation/git-commit.txt--Cltcommitgt seems to show that you can reuse the timestamp? – evolutionxbox Feb 22 '22 at 17:57
  • 1
    Answer to the second question is [probably here](https://stackoverflow.com/q/454734/184546). – TTT Feb 22 '22 at 17:58
  • Note that when you do this, you're actually creating *new and different* commits (with new, unique hash IDs). If you're the only one with the old commits, you don't have to care about this, but if you've sent the old (wrong-author/wrong-date) commits to some other Git, you do, because Git identifies commits by hash ID. The branch name, if any, is mainly for humans. – torek Feb 23 '22 at 09:04

0 Answers0