How to Git good
TL;DR: To get better at something, practice. To form a habit, commit to do it often.
This is a story about challenging myself to get into a good habit. About a hundred days and a week ago, I started Hacker School. The first day there, I learned how to use GitHub. That same day I decided to commit to committing, as part of my quest to become a drastically better programmer.
i think everyone spending a day learning to github would make a bigger impact on the world than spending a day learning to code
— Aidan Feldman (@aidanfeldman) January 15, 2014
A week later, I realized that I messed up my streak, by forgetting to commit over the weekend. Doh!
Try harder
From October 7 onwards, I tried again, this time managing to keep the chain going for a bit longer. Today my GitHub profile shows 100 days: October 07 – January 14.
Why?
First and foremost, to get good at using Git by using it everyday as practice; to keep the streak going for as many days as I could. There was/is no deadline or target to hit. But the longer I go, the harder it is for me to imagine missing a day.
What’s the point?
To learn about the various parts of maintaining repositories, GitHub etiquette/best practices and to write code every day [or at least make some progress in the form of a commit].
Tips, Tricks and Lessons Learned
- GitHub tracks commit times in PST. Here on the East Coast, that means I have until 3am to make a commit. Many nights (especially during the holidays) I would feel like Cinderella, briskly leaving a late-night party, mumbling nervously about a commit streak.
- Mainly related to #1, I discuss my commit streak with friends. This is a great way to introduce the glory of GitHub to non-programmers and discuss what I’m working on with whoever is interested. Also, sharing a goal reinforces commitment to it.
- Deleting a file is a valid update. Some of my friends said it’s “cheating”, but my defense is that cleaning up .pyc files (dating back before learning about .gitignore) is making the repo better. I promise I’m not creating files simply to delete them, that would be cheating.
- Updating a README is also a valid update! The way documentation gets better is the same way code does, though thoughtful revisions. #beginflamewar
- Too many commits with varying granularity are hard to follow as a narrative. This is true for me because I’m mainly pushing everything to branch Master. Next steps: I need to start breaking up my workflow into multiple parts, and push the code to different places such as Development and Feature branches; to track progress with a more meaningful narrative.
- One-line code edits are lazy… but on a day when I probably wouldn’t have otherwise written any code, it’s better than nothing. The theme here is continuous improvement. Most code can be improved by a minor tweak. Over time, these definitely add up.
- Opening a new issue counts too! Sometimes I’m totally stuck or I don’t have time to code. Filing an issue is a simple way to make some progress.
- The experience of moving apartments over New Year’s Eve and committing via mobile phone for a few days [while waiting for proper internet to be setup] has taught me a lot about the merits of ”don’t break the chain”
The power of this personal challenge for me is that I decided to commit each and every day, forming a new habit; the decision of whether or not to code today has been replaced with deciding what to work on.
Is this sane? How long should I keep this streak going?
nice
you have good pics too 😀