|
| 1 | +Git workflow |
| 2 | +============ |
| 3 | + |
| 4 | +Branching |
| 5 | +--------- |
| 6 | + |
| 7 | +Use one branch for a single task, unless you're fixing typos or markup on several pages. |
| 8 | +Long commit histories are hard to manage and sometimes end up stale. |
| 9 | + |
| 10 | +Start a new branch from the last commit on ``latest``. |
| 11 | +Make sure to update your local version of ``latest`` with ``git pull``. |
| 12 | +Otherwise, you may have to rebase later. |
| 13 | + |
| 14 | +Name your branch so it's clear what you're doing. Examples: |
| 15 | + |
| 16 | +* ``short-issue-description`` |
| 17 | +* ``gh-1234-short-issue-description`` |
| 18 | +* ``your-github-handle/short-issue-description`` |
| 19 | + |
| 20 | +Linking issues and PRs |
| 21 | +---------------------- |
| 22 | + |
| 23 | +When a PR is linked to an issue: |
| 24 | + |
| 25 | +* You can go from the issue straight to the PR by clicking the link in the right column. |
| 26 | +* The issue will be automatically closed when you close the PR. |
| 27 | + |
| 28 | +Specify the issue(s) you want to close in the description of your PR. GitHub will connect them if you use specific |
| 29 | +`keywords <https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword>`__. |
| 30 | +Here are some of them: |
| 31 | + |
| 32 | +* Closes #1234 |
| 33 | +* Resolves #1234 |
| 34 | +* Fixes #1234 |
| 35 | + |
| 36 | +If your PR closes more than one issue, add such a line for each issue. |
| 37 | + |
| 38 | +Commit messages |
| 39 | +--------------- |
| 40 | + |
| 41 | +* In your commit message, convey the nature of the change and possibly the reason why it was made. |
| 42 | +* Don't specify the files you've changed or the issue you're working on. |
| 43 | + The file names can be looked up in the "Files" section of the PR, and the PR description has the issue number(s). |
| 44 | +* Use the imperative mood. |
| 45 | +* Start with a capital letter, don't add ending punctuation. |
| 46 | +* Try to stick to 50 characters or so. |
| 47 | +* (Optional) Use the telegraphic style, or "headlinese", dropping the articles. |
| 48 | + |
| 49 | +Good examples |
| 50 | +~~~~~~~~~~~~~ |
| 51 | + |
| 52 | +* ``git commit -m "Expand section on msgpack"`` |
| 53 | +* ``git commit -m "Add details on IPROTO_BALLOT"`` |
| 54 | +* ``git commit -m "Create new structure"`` |
| 55 | +* ``git commit -m "Improve grammar"`` |
| 56 | + |
| 57 | +Bad examples |
| 58 | +~~~~~~~~~~~~ |
| 59 | + |
| 60 | +* ``git commit -m "Fix gh-2007, second commit"`` |
| 61 | +* ``git commit -m “Changed the file box_protocol.rst”`` |
| 62 | +* ``git commit -m "added more list items"`` |
| 63 | + |
| 64 | +Selecting a reviewer |
| 65 | +-------------------- |
| 66 | + |
| 67 | +Ideally, a PR should have two reviewers: a subject matter expert (SME) and a documentarian. |
| 68 | +The SME checks the facts, and the documentarian checks the language and style. |
| 69 | + |
| 70 | +If you're not sure who is the SME for an issue, try the following: |
| 71 | + |
| 72 | +* Check the issue description. The SME is often mentioned there explicitly. |
| 73 | +* Note who created the issue and who was involved in the discussion. |
| 74 | + |
| 75 | +Merging |
| 76 | +------- |
| 77 | + |
| 78 | +Merge when your document is ready and good enough. |
| 79 | +For external contributors, merging is blocked until a reviewer's approval. |
| 80 | + |
0 commit comments