1
- Submitting a Patch
2
- ==================
1
+ Submitting a Change
2
+ ===================
3
3
4
- Patches are the best way to provide a bug fix or to propose enhancements to
5
- Symfony.
4
+ A pull request, "PR" for short, is the best way to provide a bug fix or to propose
5
+ enhancements to Symfony.
6
6
7
- Step 1: Setup your Environment
7
+ Step 1: Check existing issues and PRs
8
+ -------------------------------------
9
+
10
+ Before working on a change, check to see if someone else also raised the topic
11
+ or maybe even started working on a PR by `searching on GitHub `_.
12
+
13
+ If you are still unsure or if you have any questions during this entire process,
14
+ please ask your questions on the #contribs channel on `Symfony Slack `_.
15
+
16
+ Step 2: Setup your Environment
8
17
------------------------------
9
18
10
19
Install the Software Stack
@@ -90,20 +99,25 @@ Check that the current Tests Pass
90
99
Now that Symfony is installed, check that all unit tests pass for your
91
100
environment as explained in the dedicated :doc: `document <tests >`.
92
101
93
- Step 2: Work on your Patch
94
- --------------------------
102
+ .. tip ::
103
+
104
+ If tests are failing, check on `Travis-CI `_ if the same test is
105
+ failing there as well. In that case you do not need to be concerned
106
+ about the test failing locally.
107
+
108
+ Step 3: Work on your PR
109
+ -----------------------
95
110
96
111
The License
97
112
~~~~~~~~~~~
98
113
99
- Before you start, you must know that all the patches you are going to submit
100
- must be released under the *MIT license *, unless explicitly specified in your
101
- commits.
114
+ Before you start, you must know that all the code you are going to submit
115
+ must be released under the *MIT license *.
102
116
103
117
Choose the right Branch
104
118
~~~~~~~~~~~~~~~~~~~~~~~
105
119
106
- Before working on a patch , you must determine on which branch you need to
120
+ Before working on a PR , you must determine on which branch you need to
107
121
work:
108
122
109
123
* ``3.4 ``, if you are fixing a bug for an existing feature or want to make a
@@ -116,28 +130,28 @@ work:
116
130
.. note ::
117
131
118
132
All bug fixes merged into maintenance branches are also merged into more
119
- recent branches on a regular basis. For instance, if you submit a patch
120
- for the ``3.4 `` branch, the patch will also be applied by the core team on
133
+ recent branches on a regular basis. For instance, if you submit a PR
134
+ for the ``3.4 `` branch, the PR will also be applied by the core team on
121
135
the ``master `` branch.
122
136
123
137
Create a Topic Branch
124
138
~~~~~~~~~~~~~~~~~~~~~
125
139
126
- Each time you want to work on a patch for a bug or on an enhancement, create a
140
+ Each time you want to work on a PR for a bug or on an enhancement, create a
127
141
topic branch:
128
142
129
143
.. code-block :: terminal
130
144
131
145
$ git checkout -b BRANCH_NAME master
132
146
133
- Or, if you want to provide a bugfix for the ``3.4 `` branch, first track the remote
147
+ Or, if you want to provide a bug fix for the ``3.4 `` branch, first track the remote
134
148
``3.4 `` branch locally:
135
149
136
150
.. code-block :: terminal
137
151
138
152
$ git checkout -t origin/3.4
139
153
140
- Then create a new branch off the ``3.4 `` branch to work on the bugfix :
154
+ Then create a new branch off the ``3.4 `` branch to work on the bug fix :
141
155
142
156
.. code-block :: terminal
143
157
@@ -167,8 +181,8 @@ uses, and replaces them by symbolic links to the ones in the Git repository.
167
181
Before running the ``link `` command, be sure that the dependencies of the project you
168
182
want to debug are installed by running ``composer install `` inside it.
169
183
170
- Work on your Patch
171
- ~~~~~~~~~~~~~~~~~~
184
+ Work on your PR
185
+ ~~~~~~~~~~~~~~~
172
186
173
187
Work on the code as much as you want and commit as much as you want; but keep
174
188
in mind the following:
@@ -181,7 +195,7 @@ in mind the following:
181
195
actually works;
182
196
183
197
* Try hard to not break backward compatibility (if you must do so, try to
184
- provide a compatibility layer to support the old way) -- patches that break
198
+ provide a compatibility layer to support the old way) -- PRs that break
185
199
backward compatibility have less chance to be merged;
186
200
187
201
* Do atomic and logically separate commits (use the power of ``git rebase `` to
@@ -210,10 +224,10 @@ in mind the following:
210
224
verb (``fixed ... ``, ``added ... ``, ...) to start the summary and don't
211
225
add a period at the end.
212
226
213
- Prepare your Patch for Submission
214
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
227
+ Prepare your PR for Submission
228
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
215
229
216
- When your patch is not about a bug fix (when you add a new feature or change
230
+ When your PR is not about a bug fix (when you add a new feature or change
217
231
an existing one for instance), it must also include the following:
218
232
219
233
* An explanation of the changes in the relevant ``CHANGELOG `` file(s) (the
@@ -223,16 +237,16 @@ an existing one for instance), it must also include the following:
223
237
``UPGRADE `` file(s) if the changes break backward compatibility or if you
224
238
deprecate something that will ultimately break backward compatibility.
225
239
226
- Step 3 : Submit your Patch
227
- -------------------------
240
+ Step 4 : Submit your PR
241
+ ----------------------
228
242
229
- Whenever you feel that your patch is ready for submission, follow the
243
+ Whenever you feel that your PR is ready for submission, follow the
230
244
following steps.
231
245
232
- Rebase your Patch
233
- ~~~~~~~~~~~~~~~~~
246
+ Rebase your PR
247
+ ~~~~~~~~~~~~~~
234
248
235
- Before submitting your patch , update your branch (needed if it takes you a
249
+ Before submitting your PR , update your branch (needed if it takes you a
236
250
while to finish your changes):
237
251
238
252
.. code-block :: terminal
@@ -246,7 +260,7 @@ while to finish your changes):
246
260
.. tip ::
247
261
248
262
Replace ``master `` with the branch you selected previously (e.g. ``3.4 ``)
249
- if you are working on a bugfix
263
+ if you are working on a bug fix.
250
264
251
265
When doing the ``rebase `` command, you might have to fix merge conflicts.
252
266
``git status `` will show you the *unmerged * files. Resolve all the conflicts,
@@ -273,7 +287,7 @@ You can now make a pull request on the ``symfony/symfony`` GitHub repository.
273
287
.. tip ::
274
288
275
289
Take care to point your pull request towards ``symfony:3.4 `` if you want
276
- the core team to pull a bugfix based on the ``3.4 `` branch.
290
+ the core team to pull a bug fix based on the ``3.4 `` branch.
277
291
278
292
To ease the core team work, always include the modified components in your
279
293
pull request message, like in:
@@ -296,10 +310,10 @@ Some answers to the questions trigger some more requirements:
296
310
* If you answer yes to "New feature?", you must submit a pull request to the
297
311
documentation and reference it under the "Doc PR" section;
298
312
299
- * If you answer yes to "BC breaks?", the patch must contain updates to the
313
+ * If you answer yes to "BC breaks?", the PR must contain updates to the
300
314
relevant ``CHANGELOG `` and ``UPGRADE `` files;
301
315
302
- * If you answer yes to "Deprecations?", the patch must contain updates to the
316
+ * If you answer yes to "Deprecations?", the PR must contain updates to the
303
317
relevant ``CHANGELOG `` and ``UPGRADE `` files;
304
318
305
319
* If you answer no to "Tests pass", you must add an item to a todo-list with
@@ -326,7 +340,8 @@ because you want early feedback on your work, add an item to todo-list:
326
340
- [ ] gather feedback for my changes
327
341
328
342
As long as you have items in the todo-list, please prefix the pull request
329
- title with "[WIP]".
343
+ title with "[WIP]". If you do not yet want to trigger the automated tests,
344
+ you can also set the PR to `draft status `_.
330
345
331
346
In the pull request description, give as much details as possible about your
332
347
changes (don't hesitate to give code examples to illustrate your points). If
@@ -339,11 +354,27 @@ commit message).
339
354
In addition to this "code" pull request, you must also send a pull request to
340
355
the `documentation repository `_ to update the documentation when appropriate.
341
356
342
- Rework your Patch
343
- ~~~~~~~~~~~~~~~~~
357
+ Step 5: Receiving Feedback
358
+ --------------------------
359
+
360
+ We ask all contributors to follow some
361
+ :doc: `best practices </contributing/community/reviews >`
362
+ to ensure a constructive feedback process.
363
+
364
+ If you think someone fails to keep this advice in mind and you want another
365
+ perspective, once again please join channel on `Symfony Slack `_. If you
366
+ receive feedback you find abusive please contact the
367
+ :doc: `CARE team</contributing/code_of_conduct/care_team.rst> `.
368
+
369
+ The :doc: `core team <contributing/code/core_team >` is responsible for deciding
370
+ which PR gets merged, so their feedback is the most relevant. So do not feel
371
+ pressured to refactor your code immediately when someone provides feedback.
372
+
373
+ Rework your PR
374
+ ~~~~~~~~~~~~~~
344
375
345
376
Based on the feedback on the pull request, you might need to rework your
346
- patch . Before re-submitting the patch , rebase with ``upstream/master `` or
377
+ PR . Before re-submitting the PR , rebase with ``upstream/master `` or
347
378
``upstream/3.4 ``, don't merge; and force the push to the origin:
348
379
349
380
.. code-block :: terminal
@@ -374,3 +405,7 @@ before merging.
374
405
.. _`fabbot` : https://fabbot.io
375
406
.. _`PSR-1` : https://www.php-fig.org/psr/psr-1/
376
407
.. _`PSR-2` : https://www.php-fig.org/psr/psr-2/
408
+ .. _``searching on GitHub: https://github.com/symfony/symfony/issues?q=+is%3Aopen+
409
+ .. _`Symfony Slack` : https://symfony.com/slack-invite
410
+ .. _`Travis-CI` : https://travis-ci.org/symfony/symfony
411
+ .. _`draft status` : https://help.github.com/en/articles/about-pull-requests#draft-pull-requests
0 commit comments