50% OFF - The Complete TDD course
Are you ready to master clean code, testing and Test-Driven Development (TDD)?
I recently launched a complete TDD course containing everything you need to craft high-quality software.
Now there is a 50% OFF for the course
Get instant access by clicking here.
Motivation
Git has been the backbone of modern software development since 2005, empowering teams to collaborate, track changes, and manage code efficiently.
But here’s the truth: A messy commit history makes troubleshooting hard.
Commit messages are your best tool for documenting the reason for change in your code. Writing them well saves time, avoids confusion, and keeps your codebase clean. Here are five tips on how I write commits in my team:
1. Explain the WHY
In a Git commit message, you should specify not only what you have done, but also WHY you have done that. It will make it easier to track changes over time and fix issues.
2. Use the imperative mood
The imperative mood means writing commit messages as if giving a command or instruction. This keeps your commit history clean and consistent:
3. Use present tense
Present tense is the right choice because commits represent changes that are always applicable—they can be checked out, merged, reverted, or cherry-picked at any time.
A properly written Git commit message should complete this sentence:
4. Add link reference to task
If you use project management tools such as Jira, GitLab, or Azure DevOps, consider including the reference ID in your commit message. This links the commit directly to the relevant task, making it easier for your team to understand the broader context of the update.
5. Summarize the WHAT, not the HOW
A commit message should clearly explain WHAT the change does, rather than describing HOW it does it. The how is already visible in the code diff, but the why and what provide essential context.
The same goes for file names—you don’t need to include them in the commit message since Git already records them in its history.
Conclusion
Clear and structured commit messages are a part of internal software quality. Another powerful way to improve software quality is to apply Test-Driven Development (TDD). It helps you write high-quality code, better and faster.
To master TDD, I recently launched my complete course, including:
The fundamentals of Test-Driven Development
Three real-world TDD examples in C#, TypeScript and Rust
Using TDD to design high-quality software
The two schools of testing with the 5 test doubles
Testing legacy code
Refactoring best practices
For frontend PRs, add before/after screenshots + videos. It makes reviewing the PR much easier.
Great tips, friend!
Great tips Daniel!