User:8680/GitGoodPractice
From The Battle for Wesnoth Wiki
Commits
- A commit should be, to quote shadowm, “sufficiently self-contained that it can be reverted and reapplied as many times as you want without leaving any related changes behind”.
- A commit to a long-running (or otherwise non-topic) branch should work on its own, without requiring subsequent commits.
- It’s fine for a commit to not work (or only partially work) if it’s a commit to a temporary topic branch, which is to be merged into (not rebased onto) another branch when the commit series achieves full functionality.
- A commit to a long-running (or otherwise non-topic) branch should work on its own, without requiring subsequent commits.
Commit messages
- A commit message consists of a summary line and a message body, which must be separated with a blank line.
- The message body should describe and explain the changes made in the commit as fully as possible.
- The message body should be hard-wrapped to 72 characters (or 72 columns; some characters can occupy multiple columns).
- The summary line should summarize the message body in such a way as to be as useful as possible for developers reviewing the commit history in the future.
- The summary line should be written in “imperative present tense”.
- The summary line should be a sentence, written without a full-stop character at the end.
- The summary line should be limited to 50 characters or less.
- shadowm professed to prefer an 80-character limit, but later clarified that that preference is not to be taken as policy.
Pull requests
- A pull request should always request the pull of a topic branch, never a long-running branch (like a ‘master’ branch).
- A pull request should be self-contained, like a commit should be.