I’ve been working off a virtual machine for some dev work recently and when I resumed the VM after it had been asleep for a while, the time was off. I hadn’t set up ntp to set the time and didn’t notice it was a few days behind until after I pushed some commits up to github.
The timestamps were all way off and I didn’t like it, not one little bit.
After some finagling around on the interwebs, I found a solution: interactive git rebase
Here’s the steps I followed to fix the times on the commits. I wanted to change the time on the
last two commits so I used
Change the first word from
edit on both lines and exit
Do the same for the other commit.
When you’re happy, you can force a push to github (but make sure no one else has pulled from it in the meantime)
And, hey presto, that’s how you modify the commit time through git. Now, go off and fix ntp, you fool!