How to write commit messages that will save you a lot of time

1 minute read

Writing good commit messages can save you a lot of time. In this blog post I want to show you an example of that. At some point in the past I changed the colours of the links on this blog from grey to blue, but where did I make this change again? Commit messages to the rescue!

I was unable to recall where in the code I made the changes by browsing through the files so I went over my commit history and… lo and behold.

Thank you, past me, for writing these awesome commit messages!

How to write good commit messages

Writing good commit messages is a tricky thing and there are a lot of different opinion on this.

What I like to do is follow a rule that I picked up somewhere. Sadly, I can’t find the source for this but it has served me well. The rule is as follows. When you write a commit messages you think to yourself

When applied, this commit will…

Here it is applied in action:

  • When applied this commit will makes links blue
  • When applied this commit will add logos and splash image
  • When applied this commit will add splash post, leetcode post, update tags

Conclusion

I never thought that my commit habits would save me this much time, but here we are. To summarize, to write good commit messages simply think to yourself:

When applied, this commit will…

Thank you for reading!

Subscribe

Tags: ,

Categories:

Updated:

Comments