|
1 | 1 | Working on the operator
|
2 | 2 | =======================
|
3 | 3 |
|
| 4 | +Contributing |
| 5 | +------------ |
| 6 | + |
| 7 | +Before we can accept any pull requests, we need you to agree to our CLA_. |
| 8 | + |
| 9 | +Once that is complete, you should: |
| 10 | + |
| 11 | +- Create an issue on GitHub to let us know that you're working on the issue. |
| 12 | + |
| 13 | +- Use a feature branch and not ``master``. |
| 14 | + |
| 15 | +- Rebase your feature branch onto the upstream ``master`` before creating the |
| 16 | + pull request. |
| 17 | + |
| 18 | +- `Be descriptive in your PR and commit messages |
| 19 | + <#meaningful-commit-messages>`_. What is it for? Why is it needed? And so on. |
| 20 | + |
| 21 | +- If applicable, `run the tests <#testing>`_. |
| 22 | + |
| 23 | +- Squash related commits. |
| 24 | + |
| 25 | + |
| 26 | +.. _testing: |
| 27 | + |
4 | 28 | Testing
|
5 | 29 | -------
|
6 | 30 |
|
@@ -88,5 +112,76 @@ For the following steps we assume the next version is going to be ``$VERSION``.
|
88 | 112 | $ git pull
|
89 | 113 | $ ./devtools/create_tag.sh "$VERSION"
|
90 | 114 |
|
| 115 | +
|
| 116 | +General Tips |
| 117 | +------------ |
| 118 | + |
| 119 | +.. _commit-message-style: |
| 120 | + |
| 121 | +Meaningful Commit Messages |
| 122 | +^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 123 | + |
| 124 | +Please choose a meaningful commit message. The commit message is not only |
| 125 | +valuable during the review process, but can be helpful for reasoning about any |
| 126 | +changes in the code base. For example, PyCharm's "Annotate" feature, brings up |
| 127 | +the commits which introduced the code in a source file. Without meaningful |
| 128 | +commit messages, the commit history does not provide any valuable information. |
| 129 | + |
| 130 | +The first line of the commit message (also known as "subject line") should |
| 131 | +contain a summary of the changes. Please use the imperative mood. The subject |
| 132 | +can be prefixed with "Test: " or "Docs: " to indicate the changes are not |
| 133 | +primarily to the main code base. For example:: |
| 134 | + |
| 135 | + Put a timeout on all bootstrap operations |
| 136 | + Test: Increase bootstrap timeout in tests |
| 137 | + Docs: Copyedit docs on configuration options |
| 138 | + |
| 139 | +See also: https://chris.beams.io/posts/git-commit/ |
| 140 | + |
| 141 | +Updating Your Branch |
| 142 | +^^^^^^^^^^^^^^^^^^^^ |
| 143 | + |
| 144 | +If new commits have been added to the upstream ``master`` branch since you |
| 145 | +created your feature branch, please do not merge them in to your branch. |
| 146 | +Instead, rebase your branch:: |
| 147 | + |
| 148 | + $ git fetch upstream |
| 149 | + $ git rebase upstream/master |
| 150 | + |
| 151 | +This will apply all commits on your feature branch on top of the upstream |
| 152 | +``master`` branch. If there are conflicts, they can be resolved with ``git |
| 153 | +merge``. After the conflict has been resolved, use ``git rebase --continue`` to |
| 154 | +continue the rebase process. |
| 155 | + |
| 156 | +Squashing Minor Commits |
| 157 | +^^^^^^^^^^^^^^^^^^^^^^^ |
| 158 | + |
| 159 | +Minor commits that only fix typos or rename variables that are related to a |
| 160 | +bigger change should be squashed into that commit. |
| 161 | + |
| 162 | +This can be done with the following command:: |
| 163 | + |
| 164 | + $ git rebase -i origin/master |
| 165 | + |
| 166 | +This will open up a text editor where you can annotate your commits. |
| 167 | + |
| 168 | +Generally, you'll want to leave the first commit listed as ``pick``, or change |
| 169 | +it to ``reword`` (or ``r`` for short) if you want to change the commit message. |
| 170 | +And then, if you want to squash every subsequent commit, you could mark them |
| 171 | +all as ``fixup`` (or ``f`` for short). |
| 172 | + |
| 173 | +Once you're done, you can check that it worked by running:: |
| 174 | + |
| 175 | + $ git log |
| 176 | + |
| 177 | +If you're happy with the result, do a **force** push (since you're rewriting |
| 178 | +history) to your feature branch:: |
| 179 | + |
| 180 | + $ git push -f |
| 181 | + |
| 182 | + |
| 183 | +See also: http://www.ericbmerritt.com/2011/09/21/commit-hygiene-and-git.html |
| 184 | + |
| 185 | +.. _CLA: https://crate.io/community/contribute/agreements/ |
91 | 186 | .. _setuptools-scm: https://pypi.org/project/setuptools-scm/
|
92 | 187 | .. _Semantic Versioning: https://semver.org/
|
0 commit comments