Menu

What Makes a Good Git Commit?
📰

What Makes a Good Git Commit?

DEV Community: github·Soumyajit Mukherjee·about 21 hours ago
#HTPvrNj9
#devtogithub#technology#devto#dev#commits
Reading 0:00
15s threshold

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

Enter fullscreen mode

Exit fullscreen mode

These messages aren't very useful.

A Better Commit

Instead of:

fixed stuff

Enter fullscreen mode

Exit fullscreen mode

write:

Fix duplicate order creation during checkout

Enter fullscreen mode

Exit fullscreen mode

A good commit should communicate the purpose of the change.

Keep Commits Focused

A commit like:

Add authentication

Enter fullscreen mode

Exit fullscreen mode

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…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.