Cover Image

Plan Your Commits

410 words. Time to Read: About 4 minutes.

I don’t know if this is common or not, but I have a really hard time remembering to commit my code. I know commits are supposed to be meaningful and logical chunks of work that tell a story when viewed in aggregate. And yet… I still find myself chugging along until I get ready to get up from coding without having committed anything! My commit is a giant blob with a message like “finished most of the features.” Hopefully there is someone out there who is like me. Hopefully this post speaks to that one person who hyperfocuses on a problem and forgets to commit (or move, or eat, or go outside, or speak to other human persons). Because I discovered a solution.

Plan. Your. Commits.

That’s it! Mind blown right? Who could have conceived of such genius?! Surely no one has considered envisioning what you are about to do before you do it before now! Shut up, it was a new idea to me. Here’s my thought process:

A lot of the tutorials that I’ve gone through where Git has been included seem to assume you are a pro committer already. They say things like, “There we go, that seems like a good spot for a commit,” or “You’ll want to commit your work now.” This led me to believe that I could just code along and it would be abundantly obvious to me when I should be committing.

Nope.

However, I have found that if I preselect my checkpoint, I forget less. Saying things like, “I’ll commit again after I’ve finished this function,” or “after I get the url routing hooked up” works a lot better. Mostly. The idea is that once I get there, I can commit, come up for air, see where I’m at, and see where I need to go. It also helps me not need to hold everything in my head and helps (some) for if I leave the project alone for a few days and want to come back. More stuff is written down and less is bouncing around in my head.

So, if your commits look like a pile of [rhymes with commit], try writing your commit message (in your head) before you write the code. If you have a better way, OR, if you have other tricks that would help me keep my head on straight in the long run, please share them! I’d love to hear them.

Author: Ryan Palo | Tags: tricks git | Buy me a coffee Buy me a coffee

Like my stuff? Have questions or feedback for me? Want to mentor me or get my help with something? Get in touch! To stay updated, subscribe via RSS