365 Days of code: Day 7 -> Week 1

Hacking GitHub

History will be kind to me for I intend to write it.

Winston Churchil

On the 8th of Jan, I did write some code that I couldn’t push to Github. I got too drunk at night and what I intended to be a short power nap turned into a deep slumber till the wee hours of the next morning.

So that means, I have a blank square in my GitHub contributions chart, with zero contribution on Jan 8, 2019. Now I understand what you’re thinking. If I can do past dated git commits, then there will be no transparency with respect to my GitHub activity. While it’s true, I would also like to point out that the main purpose of this activity, to begin with, was to make progress in terms of new learning and document it in this blog.

What matters is I develop a regular habit of improving my knowledge and keep a record of it. If that means learning how to do past dated commits on GitHub on one of the days, so be it. So, today I’m going to try just that and push a commit to GitHub by going back in time to the 8th of January.

After a few google searches, I finally found the command that did the job. The details can be found here.

Git command

git commit --amend --date "Tue, 08 Jan 2019 12:40:00 +0530"

Before

After

Conclusion

So, today we learned how to make a past dated commit to GitHub or any git repository for that matter. This is a very useful thing since it might happen that you are required to make a commit everyday at your job and you might miss that by a few seconds past midnight. This trick is useful to make a commit to a pas

Leave Comment

Your email address will not be published. Required fields are marked *

Scroll Up