Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I change commit time (not pushed yet)?

Tags:

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.

like image 603
Andrew T Avatar asked Feb 25 '09 09:02

Andrew T


People also ask

How do you change the time of a commit?

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.

How do I change a commit before pushing?

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.


1 Answers

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
like image 188
Eric Avatar answered Nov 08 '22 04:11

Eric