How can I change the time I've made a commit in my local repository?
Suppose I've done several commits and noticed that the date on my computer is wrong. Suppose also that these commits were not pushed anywhere yet.
Just do git commit --amend --reset-author --no-edit . For older commits, you can do an interactive rebase and choose edit for the commit whose date you want to modify.
If the commit only exists in your local repository and has not been pushed to GitHub.com, you can amend the commit message with the git commit --amend command. On the command line, navigate to the repository that contains the commit you want to amend. Type git commit --amend and press Enter.
If it's just a single commit, and that commit is the most recent one (on whatever branch you're on), a quick one-liner for doing this is:
hg commit --amend -d now
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With