Skip to content

Commit be0cfda

Browse files
danielRepjosecm
authored andcommitted
feat(split_prs): add description on the split of large PRs
Signed-off-by: Daniel Oliveira <[email protected]>
1 parent cf60185 commit be0cfda

File tree

1 file changed

+36
-5
lines changed

1 file changed

+36
-5
lines changed

source/development/contributing.rst

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,11 @@ over the original repository, you carry out the development directly on it. Foll
104104
<https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History>`_, by rebasing it on ``main``;
105105
4. `Create a PR <https://docs.github.com/en/pull-requests/
106106
collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-
107-
requests/creating-a-pull-request>`_ targeting the original repository's ``main`` branch;
107+
requests/creating-a-pull-request>`_ targeting the original repository's ``main`` branch. In case
108+
the PR introduces a large set of modifications, to facilitate the review process, it is
109+
recommended to split it into multiple smaller PRs (i.e., :ref:`splitting large PRs
110+
<split_prs>`). Ultimately, the assignee will ask you to split the PR if they feel it is too
111+
large;
108112
5. Patiently wait for reviews and be engaged when they arrive:
109113

110114
* participate in the discussion with **reviewers**;
@@ -119,6 +123,33 @@ over the original repository, you carry out the development directly on it. Foll
119123
modification requests;
120124
* if the **reviewers** are taking too long, try contacting the :term:`PR` assignee.
121125

126+
.. _split_prs:
127+
128+
Splitting Large PRs
129+
###################
130+
131+
Code reviews are typically a difficult and time-consuming process. To facilitate the reviewer's
132+
work, contributors should try to split their PRs into smaller ones if they feel that the PR
133+
introduces a large set of modifications. Nevertheless, the PR assignee decides if the PR is too
134+
large and may request splitting it.
135+
136+
To split your large PR, a contributor should follow this process:
137+
138+
* create a topic branch from the ``main`` branch and call it ``wip/<feat_name>``. The branch should
139+
be protected (:ref:`branch protection rules<branch_protection>`). The ``<feat_name>`` should be a
140+
short description of the feature, subsystem, or functionality being developed. External
141+
contributors should ask maintainers to create this branch for them, whom will become responsible
142+
for managing the ``wip`` branch and synchronizing with the external contributor;
143+
* this ``wip/<feat_name>`` should be the base branch of the overall feature to be submitted. For
144+
example, it can be a skeleton PR that only contains the infrastructure of the new functionality;
145+
* submit this base branch as a draft PR and mention on the PR description that it is the base
146+
branch for a big feature that will be submitted in multiple PRs;
147+
* continue to introduce the remaining components of the feature one PR at a time, ensuring that
148+
each PR is as self-contained as possible.
149+
* when each sub-feature PR is accepted and merged into the ``wip/<feat_name>`` branch and the
150+
feature is complete, the assignee is responsible to merge the ``wip/<feat_name>`` branch into
151+
``main``.
152+
122153
.. _chain_prs:
123154

124155
Chain of PRs
@@ -493,10 +524,10 @@ file.
493524
Branch Protection
494525
*****************
495526

496-
All repositories' ``main`` branch must be configured with a set of protection rules that aim at
497-
ensuring some of the rules defined in :ref:`contribution workflow<contribution_workflow>`. In the
498-
repository's ``Settings -> Branches`` menu, the protection rules must be created with the following
499-
options:
527+
All repositories should have protection rules configured for both the ``main`` and ``wip/``
528+
branches. These rules are designed to enforce the guidelines outlined in the :ref:`contribution
529+
workflow<contribution_workflow>`. In the repository's ``Settings -> Branches`` menu, the protection
530+
rules must be created with the following options:
500531

501532
* Require a pull request before merging:
502533

0 commit comments

Comments
 (0)