|
| 1 | +Commit Conventions |
| 2 | +================== |
| 3 | + |
| 4 | +The Symfony CMF uses a convention for the commits. This isn't a requirement |
| 5 | +when contributing to the CMF, but it is created to have meaningfull commits |
| 6 | +for big new features. |
| 7 | + |
| 8 | +Squashing |
| 9 | +--------- |
| 10 | + |
| 11 | +Before a Pull Request is merged, the commits should be squashed (i.e. there |
| 12 | +should be a single commit in the Pull Request with all your work in it). |
| 13 | + |
| 14 | +You can easily squash a commit using `git rebase` as follows: |
| 15 | + |
| 16 | +.. code-block:: bash |
| 17 | +
|
| 18 | + $ git rebase --interactive HEAD~<number of commits in your pull request> |
| 19 | +
|
| 20 | +For example, if your pull request on github has 4 commits: |
| 21 | + |
| 22 | +.. code-block:: bash |
| 23 | +
|
| 24 | + $ git rebase --interactive HEAD~4 |
| 25 | +
|
| 26 | +You will then be presented with a screen in your editor which looks something |
| 27 | +like this: |
| 28 | + |
| 29 | +.. code-block:: bash |
| 30 | +
|
| 31 | + pick 5d4530b port features from simple cms into routing bundle to simplify things |
| 32 | + pick 1a0eea3 cs fixes and cleanups according to feedback |
| 33 | + pick 8cbab56 convert settings to options |
| 34 | + pick 8f3e4f9 cleanups for the options refactoring |
| 35 | +
|
| 36 | +Tell github to pick the first one and squash the rest as follows: |
| 37 | + |
| 38 | +.. code-block:: bash |
| 39 | +
|
| 40 | + pick 5d4530b port features from simple cms into routing bundle to simplify things |
| 41 | + s 1a0eea3 cs fixes and cleanups according to feedback |
| 42 | + s 8cbab56 convert settings to options |
| 43 | + s 8f3e4f9 cleanups for the options refactoring |
| 44 | +
|
| 45 | +Save the file and quit. GIT should now squash all your commits and ask you |
| 46 | +for a new commit message. |
| 47 | + |
| 48 | +Commit Message |
| 49 | +-------------- |
| 50 | + |
| 51 | +The commit message should be formatted as follows: |
| 52 | + |
| 53 | +.. code-block:: text |
| 54 | +
|
| 55 | + [<scope>] <short description> |
| 56 | +
|
| 57 | + Fixes: <list of issues fixed> |
| 58 | +
|
| 59 | + <long description> |
| 60 | +
|
| 61 | + BC Breaks (as required) |
| 62 | + --------- |
| 63 | +
|
| 64 | + <list of BC breaks and required migrations> |
| 65 | +
|
| 66 | + Deprecations (as required) |
| 67 | + ------------ |
| 68 | +
|
| 69 | + <list of deprecations> |
| 70 | +
|
| 71 | +For example, the commit message of a PR fixing 2 issues and adding 2 BC breaks |
| 72 | +would be: |
| 73 | + |
| 74 | +.. code-block:: text |
| 75 | +
|
| 76 | + [Initializer] Initializers use ManagerRegistry |
| 77 | +
|
| 78 | + Fixes: #1234, #4321 |
| 79 | +
|
| 80 | + Initializers are now passed an instance of `ManagerRegistry` instead |
| 81 | + of the `Phpcr\Session`. This means that initializers can retrieve both |
| 82 | + the PHPCR session and the `DocumentManager`. |
| 83 | +
|
| 84 | + This PR also introduces a requirement that all initializers provide a name |
| 85 | + which can be used in diagnostics. |
| 86 | +
|
| 87 | + BC Breaks |
| 88 | + --------- |
| 89 | +
|
| 90 | + - The `init` method of the InitializerInterface now accepts a |
| 91 | + `ManagerResistry` instead of a `PhpcrSession`. The PHPCR session can |
| 92 | + be retrieved using `$registry->getConnection` and the manager with |
| 93 | + `$registry->getManager()`; |
| 94 | +
|
| 95 | + - The first argument to the `GenericInitializer` constructor is now the |
| 96 | + name of the initializer. |
| 97 | +
|
| 98 | +Short Commit Message |
| 99 | +~~~~~~~~~~~~~~~~~~~~ |
| 100 | + |
| 101 | +Not all Pull Requests require this much information for the commit. In most |
| 102 | +cases, a more simpler commit convention is enough: |
| 103 | + |
| 104 | +.. code-block:: text |
| 105 | +
|
| 106 | + <bug|feature|minor> [<scope>] <short description> |
| 107 | +
|
| 108 | +Where ``bug`` refers to a commit fixing bugs, ``feature`` to a commit adding |
| 109 | +features and ``minor`` to commits adding less relevant things (fixing code |
| 110 | +standard, adding comments, fixing typos, etc.). |
0 commit comments