Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Will Git commits with incorrect dates in the future overwrite future work?

Tags:

git

github

enter image description here

Hello,in my project I have a payroll system and sometimes I had to change my computer's date in order to test if my system works well, now as you can see I have made 2 previous commits on future dates, my question is what happens when these dates come? Will it override my commits? Because 23 sep and 23 October were supposed to be 23 August, and I have made much much more commits after these two.

Thanks.

like image 935
Ameen Assadi Avatar asked Aug 25 '21 12:08

Ameen Assadi


People also ask

Can you change the date of a git 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 overwrite a previous commit?

If you've already created a fresh commit, you'll want to use git rebase -i to squash your commit on top of the old one. After you've made this change locally, and verified your commit looks the way you want it to, you'll have to git push --force to overwrite history on the Github remote.

How do I hide commit time on github?

Hide commit history on Git Branch First, create a new temporary branch and checkout. Now, add all the current files to this temporary branch. Create a new commit. Rename the temporary branch to your old branch name.


1 Answers

What happens when these dates come? Will it override my commits?

No! Each commit is identified by an unique hash-code based on the actual content plus some metadata (like the IDs of the parent commits).


You could consider to change the date of the commits:

How can one change the timestamp of an old commit in Git?

like image 108
jschnasse Avatar answered Oct 20 '22 08:10

jschnasse