The "OhSnap!" series explores bite-sized tips that you can apply today.
Sometimes becoming a better developer comes down to slight course corrections in our daily workflows.
Recently I came across this awesome article by, Chris Beams, that explains how to do that with an action we all perform — git commits.
Write git commits imperatively, not as a description.
git commit -m "Added new page"
git commit -m "Fixed margin above the hero banner for a better layout"
git commit -m "This adds a new color"
git commit -m "Add About page"
git commit -m "Fix spacing above the hero banner"
git commit -m "Change headline color"
The second versions are all actions. They sound abrupt, but they are meant to instruct what is about to happen, not describe why you did something.
Notice that even as imperative actions, they still communicate with specificity on exactly what was done.
At the end of the day, all we really want to know is what this commit will do to our main branch if merged. The body of the commit or a pull request can always hold the details of why you did something.
Chris Beams gives a fantastic sentence to test your commits against. If the sentence still makes sense afterwards, then it is a strong imperative commit.
If applied, this commit will your message here
git commit -m "If applied, this commit will Change headline color"
git commit -m "If applied, this commit will changes new color"
I highly encourage you to read the full article, as there are many more great tips in there.