@@ -23,6 +23,7 @@ had several contributions accepted, commit privileges are often quickly granted.
2323* [ Checklist for submitting contribution] ( #checklist-for-submitting-contribution )
2424* [ What happens after submitting contribution?] ( #what-happens-after-submitting-contribution )
2525* [ What happens when your contribution is applied?] ( #what-happens-when-your-contribution-is-applied )
26+ * [ Git commit rules] ( #git-commit-rules )
2627
2728## Pull requests
2829
@@ -277,4 +278,120 @@ Your name will likely be included in the Git commit log. If your change affects
277278end users, a brief description and your name might be added to the [ NEWS] ( /NEWS )
278279file.
279280
281+ ## Git commit rules
282+
283+ This section refers to contributors that have Git push access and make commit
284+ changes themselves. We'll assume you're basically familiar with Git, but feel
285+ free to post your questions on the mailing list. Please have a look at the more
286+ detailed [ information on Git] ( https://git-scm.com/ ) .
287+
288+ PHP is developed through the efforts of a large number of people. Collaboration
289+ is a Good Thing(tm), and Git lets us do this. Thus, following some basic rules
290+ with regards to Git usage will:
291+
292+ * Make everybody happier, especially those responsible for maintaining PHP
293+ itself.
294+ * Keep the changes consistently well documented and easily trackable.
295+ * Prevent some of those 'Oops' moments.
296+ * Increase the general level of good will on planet Earth.
297+
298+ Having said that, here are the organizational rules:
299+
300+ 1 . Respect other people working on the project.
301+
302+ 2 . Discuss any significant changes on the list before committing and get
303+ confirmation from the release manager for the given branch.
304+
305+ 3 . Look at [ EXTENSIONS] ( /EXTENSIONS ) file to see who is the primary maintainer
306+ of the code you want to contribute to.
307+
308+ 4 . If you "strongly disagree" about something another person did, don't start
309+ fighting publicly - take it up in private email.
310+
311+ 5 . If you don't know how to do something, ask first!
312+
313+ 6 . Test your changes before committing them. We mean it. Really. To do so use
314+ ` make test ` .
315+
316+ 7 . For development use the ` --enable-debug ` switch to avoid memory leaks and the
317+ ` --enable-maintainer-zts ` switch to ensure your code handles TSRM correctly
318+ and doesn't break for those who need that.
319+
320+ Currently we have the following branches in use:
321+
322+ | Branch | |
323+ | --------- | --------- |
324+ | master | Active development branch for PHP 8.0, which is open for backwards incompatible changes and major internal API changes. |
325+ | PHP-7.4 | Active development branch for PHP 7.4, which is open for new features and minor internal API changes. |
326+ | PHP-7.3 | Is used to release the PHP 7.3.x series. This is a current stable version and is open for bugfixes only. |
327+ | PHP-7.2 | Is used to release the PHP 7.2.x series. This is a current stable version and is open for bugfixes only. |
328+ | PHP-7.1 | Is used to release the PHP 7.1.x series. This is an old stable version and is open for security fixes only. |
329+ | PHP-7.0 | This branch is closed. |
330+ | PHP-5.6 | This branch is closed. |
331+ | PHP-5.5 | This branch is closed. |
332+ | PHP-5.4 | This branch is closed. |
333+ | PHP-5.3 | This branch is closed. |
334+ | PHP-5.2 | This branch is closed. |
335+ | PHP-5.1 | This branch is closed. |
336+ | PHP-4.4 | This branch is closed. |
337+ | PHP-X.Y.Z | These branches are used for the release managers for tagging the releases, hence they are closed to the general public. |
338+
339+ The next few rules are more of a technical nature:
340+
341+ 1 . All non-security bugfix changes should first go to the lowest bugfix branch
342+ (i.e. 7.2) and then get merged up to all other branches. All security fixes
343+ should go to the lowest security fixes branch (i.e 7.1). If a change is not
344+ needed for later branches (i.e. fixes for features which were dropped from
345+ later branches) an empty merge should be done.
346+
347+ 2 . All news updates intended for public viewing, such as new features, bug
348+ fixes, improvements, etc., should go into the NEWS file of * any stable
349+ release* version with the given change. In other words, news about a bug fix
350+ which went into PHP-5.4, PHP-5.5 and master should be noted in both
351+ PHP-5.4/NEWS and PHP-5.5/NEWS but not master, which is not a public released
352+ version yet.
353+
354+ 3 . Do not commit multiple files and dump all messages in one commit. If you
355+ modified several unrelated files, commit each group separately and provide a
356+ nice commit message for each one. See example below.
357+
358+ 4 . Do write your commit message in such a way that it makes sense even without
359+ the corresponding diff. One should be able to look at it, and immediately
360+ know what was modified. Definitely include the function name in the message
361+ as shown below.
362+
363+ 5 . In your commit messages, keep each line shorter than 80 characters. And try
364+ to align your lines vertically, if they wrap. It looks bad otherwise.
365+
366+ 6 . If you modified a function that is callable from PHP, prepend PHP to the
367+ function name as shown below.
368+
369+ The format of the commit messages is pretty simple.
370+
371+ <max 79 characters short description>\n
372+ \n
373+ <long description, 79 chars per line>
374+ \n
375+
376+ An Example from the git project (commit 2b34e486bc):
377+
378+ pack-objects: Fix compilation with NO_PTHREDS
379+
380+ It looks like commit 99fb6e04 (pack-objects: convert to use parse_options(),
381+ 2012-02-01) moved the #ifdef NO_PTHREDS around but hasn't noticed that the
382+ 'arg' variable no longer is available.
383+
384+ If you fix some bugs, you should note the bug ID numbers in your commit message.
385+ Bug ID should be prefixed by ` # ` .
386+
387+ Example:
388+
389+ Fixed bug #14016 (pgsql notice handler double free crash bug.)
390+
391+ When you change the NEWS file for a bug fix, then please keep the bugs sorted in
392+ decreasing order under the fixed version.
393+
394+ You can use [ gitweb] ( https://git.php.net/ ) to look at PHP Git repository in
395+ various ways.
396+
280397Thank you for contributing to PHP!
0 commit comments