Skip to content

Commit f02a7e1

Browse files
authored
Add git workflow guidelines (#2688)
Resolves #1884
1 parent 0447a6c commit f02a7e1

File tree

2 files changed

+98
-0
lines changed

2 files changed

+98
-0
lines changed

doc/contributing/docs.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ The guidelines are a work in progress, and we welcome all contributions.
2020
docs/build
2121
docs/sphinx-warnings
2222
docs/infra
23+
docs/git

doc/contributing/docs/git.rst

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
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, mention each of them:
37+
38+
.. code-block::
39+
40+
Resolves #1300, resolves #1234, resolves tarantool/doc#100
41+
42+
Commit messages
43+
---------------
44+
45+
* Most of the time, one-line commit messages are sufficient for documentation changes.
46+
47+
- When you squash commits at merge, the resulting commit message is a sum of all commit messages in the PR.
48+
It is advised to include the "resolves" string in the first commit.
49+
Otherwise, there's a risk that this line won't be included in the merge commit.
50+
51+
* Convey the nature of the change and possibly the reason why it was made.
52+
53+
- Don't specify the files you've changed or the issue you're working on.
54+
The file names can be looked up in the "Files" section of the PR, and the PR description has the issue number(s).
55+
56+
* Try keeping the commit title 50 characters or shorter.
57+
* Use the imperative mood.
58+
* Start with a capital letter, don't add ending punctuation.
59+
* (Optional) Use the telegraphic style, or "headlinese", dropping the articles.
60+
61+
Good examples
62+
~~~~~~~~~~~~~
63+
64+
* ``git commit -m "Expand section on msgpack"``
65+
* ``git commit -m "Add details on IPROTO_BALLOT"``
66+
* ``git commit -m "Create new structure"``
67+
* ``git commit -m "Improve grammar"``
68+
69+
Bad examples
70+
~~~~~~~~~~~~
71+
72+
* ``git commit -m "Fix gh-2007, second commit"``
73+
* ``git commit -m “Changed the file box_protocol.rst”``
74+
* ``git commit -m "added more list items"``
75+
76+
Selecting a reviewer
77+
--------------------
78+
79+
Ideally, a PR should have two reviewers: a subject matter expert (SME) and a documentarian.
80+
The SME checks the facts, and the documentarian checks the language and style.
81+
82+
If you're not sure who the SME for an issue is, try the following:
83+
84+
* Check the issue description. The SME is often mentioned there explicitly.
85+
* Note who created the issue and who was involved in the discussion.
86+
87+
Merging
88+
-------
89+
90+
Merge when your document is ready and good enough.
91+
For external contributors, merging is blocked until a reviewer's approval.
92+
93+
* Always squash commits.
94+
* Make sure the commit message mentions all relevant issues with "resolves" or "fixes".
95+
* Make sure you've
96+
`attributed <https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-with-multiple-authors>`__
97+
all participants with ``Co-authored-by``.

0 commit comments

Comments
 (0)