Most commit messages are next to useless because they focus on WHAT was done instead of WHY.

This is exactly the wrong thing to focus on.

You can always reconstruct what changes a commit contains, but it's near impossible to unearth the reason it was done.

(thread)

Think about the last time you `git blame`d something.

You were almost certainly thinking "WHY is this like this?", not "What is a one-line summary of what happened in this commit?".
Here's the antidote: use this commit template (stolen from @joeferris).

```
[one line-summary of changes]

Because:
- [relevant context]
- [why you decided to change things]
- [reason you're doing it now]

This commit:
- [does X]
- [does Y]
- [does Z]
```
Leading with the WHY has tremendous value.

First, it captures context that will be near impossible to recover later. Trust me, this stuff is gold.

Secondly, if you train yourself to ask why you're making every change, you'll tend to make better changes.
Give this template a try for a while.

The first time you see a commit message like the above instead of "refactor OrderWidget", you'll be a convert.
For more thoughts on this topic, and details on setting up a commit message template, check out this post.

https://t.co/8e9p3x0zb0
Also! Here are a few examples of this commit message template in action:

https://t.co/KrOvHJPMXg

https://t.co/rnWpApDrTx

https://t.co/R7tAV3b8rx

More from Tech

You May Also Like

There are some amazing founders and indie hackers that have made 🤯-worthy progress this last year.

The stuff you can do in a year is seriously astounding 👇

👉 @TransistorFM reaching $22k MRR in one year:
https://t.co/BuKmXEeEtH

I was one of their first customers and the progress @mijustin and @jonbuda have made working mostly part-time has been crazy.

Now both are full-time. Follow them on @buildyoursaas

👉 @talk2oneup reaching $10k MRR in one year: https://t.co/SOoGkKA19r

@daviswbaer joined as a co-founder and through many different marketing tactics, pricing changes, and product updates, they've managed to carve out a niche market in a really competitive industry.

👉 @hostifi_net $9k MRR in one year: https://t.co/TknroGZWoK

After getting fired from his full-time job, @_rchase_ embarked on a year focused on building products to replace his salary in a year.

The dude seriously SHIPS and even took investment from @earnestcapital


👉 @ClosetTools $11k MRR WHILE WORKING FULL-TIME AND WITH A FAMILY: https://t.co/pKQ7pFvpZY

With a strong product, continuous improvement, and SEO, @unindie has really been inspirational.

There are no excuses.