Git commits are more than checkpoints.
They form a historical record of how a project evolved.
Unfortunately, many repositories contain commits like:
update
fix
changes
final
final2
please work
These messages aren't very useful.
A Better Commit
Instead of:
fixed stuff
write:
Fix duplicate order creation during checkout
A good commit should communicate the purpose of the change.
Keep Commits Focused
A commit like:
Add authentication
might include:
- Login
- Registration
- Password reset
- UI redesign
- Database migration
- Random formatting changes That's difficult to review.
Instead, separate logical changes when possible.
Why Small Commits Help
Focused commits make it easier to:
- Review code
- Revert changes
- Find bugs
- Understand history
- Cherry-pick changes
- Debug regressions
Conventional Commits
Some teams use a convention such as:
feat: add password reset flow
fix: prevent duplicate payments
docs: update installation guide
refactor: simplify user service
test: add order validation tests
This creates predictable history.
Commit Messages Should Explain Why
This:
Update payment service
is vague.
This is better:
Retry failed payment requests after temporary gateway errors
The second message tells future developers what changed and why it matters.
Final Thoughts
Your Git history is documentation.
Write commits as if someone will need to understand them six months from now.
Top comments (0)