Chapter 3 of 14All chapters
Chapter 3 of 14
Committing
Making a change part of history.
The command
git commit -m "message" records what is staged. Leaving off -m opens an editor, which is the right choice when the message needs a body as well as a subject line.
- Write the subject in the imperative: "add rate limit", not "added rate limit".
- git commit --amend rewrites the last commit, which is safe only before you push.
Size of a commit
A commit should be one idea. Small commits make history readable, make reverting cheap, and make it obvious which change broke something.