Skip to content
Discussion options

You must be logged in to vote

General rule I go by: one commit = one logical change. If you need "and" to describe what it does, it's probably two commits.

Not really about size, more about purpose — a typo fix inside the feature you're working on can ride along, but an unrelated one-liner should still get its own commit.

Combine changes when they only make sense together, like a function and its test.

I usually plan commits before coding, not after — break the feature into steps (model, endpoint, UI, tests, docs) and commit as I go. Untangling one big mess afterward is way more painful.

A few habits that help:

  • git status / git diff before staging
  • git add -p to split a messy diff into chunks
  • imperative messages: "add…

Replies: 4 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@hasheramin5-cyber
Comment options

@RajGupta0510
Comment options

Comment options

You must be logged in to vote
2 replies
@hasheramin5-cyber
Comment options

@Kunal241207
Comment options

Answer selected by hasheramin5-cyber
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Repositories The core of version-controlled code storage Question Ask and answer questions about GitHub features and usage Welcome 🎉 Used to greet and highlight first-time discussion participants. Welcome to the community! source:ui Discussions created via Community GitHub templates
5 participants