Git Hack: Make commit with a past date

Hello reader!

Ever wanted to commit something to a git repo with a past date? Here’s how you could do it.

If you are working on a project and missed a commit yesterday or you accomplished the task but GitHub for Windows bailed on you? Well, this lit…


This content originally appeared on DEV Community and was authored by Ayushi Rawat

Hello reader!

Ever wanted to commit something to a git repo with a past date? Here’s how you could do it.

If you are working on a project and missed a commit yesterday or you accomplished the task but GitHub for Windows bailed on you? Well, this little hack can solve your problem.

Check the YouTube video tutorial for live demonstration and better Understanding.

Pre-Step.
Pull all data from remote to the local repository.

For the same, we are using the --amend and --date switches.
The exact command is as follows:

$ git commit --amend --date="YYYY-MM-DD HH:MM:SS"

Simple isn't it!

And with that, it's a wrap! I hope you found the article useful! Share in the comments below.
I create content about Career, Blogging, Programming, and Productivity, If this is something that interests you, please share the article with your friends and connections. You can also subscribe to my newsletter to get updates every time I write something!

Thank you for reading, If you have reached so far, please like the article, It will encourage me to write more such articles. Do share your valuable suggestions, I appreciate your honest feedback!

I would strongly recommend you to Check out the YouTube video of the same and don't forget to subscribe to my Channel. I would love to connect with you at Twitter | LinkedIn.

You should definitely check out my other Blogs:

See you in my next Blog article, Take care!!


This content originally appeared on DEV Community and was authored by Ayushi Rawat


Print Share Comment Cite Upload Translate Updates
APA

Ayushi Rawat | Sciencx (2021-06-16T04:45:06+00:00) Git Hack: Make commit with a past date. Retrieved from https://www.scien.cx/2021/06/16/git-hack-make-commit-with-a-past-date/

MLA
" » Git Hack: Make commit with a past date." Ayushi Rawat | Sciencx - Wednesday June 16, 2021, https://www.scien.cx/2021/06/16/git-hack-make-commit-with-a-past-date/
HARVARD
Ayushi Rawat | Sciencx Wednesday June 16, 2021 » Git Hack: Make commit with a past date., viewed ,<https://www.scien.cx/2021/06/16/git-hack-make-commit-with-a-past-date/>
VANCOUVER
Ayushi Rawat | Sciencx - » Git Hack: Make commit with a past date. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/06/16/git-hack-make-commit-with-a-past-date/
CHICAGO
" » Git Hack: Make commit with a past date." Ayushi Rawat | Sciencx - Accessed . https://www.scien.cx/2021/06/16/git-hack-make-commit-with-a-past-date/
IEEE
" » Git Hack: Make commit with a past date." Ayushi Rawat | Sciencx [Online]. Available: https://www.scien.cx/2021/06/16/git-hack-make-commit-with-a-past-date/. [Accessed: ]
rf:citation
» Git Hack: Make commit with a past date | Ayushi Rawat | Sciencx | https://www.scien.cx/2021/06/16/git-hack-make-commit-with-a-past-date/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.