|
| 1 | +# Contributing to a ODMDev project |
| 2 | +_Do you have a contribution? We welcome contributions, but please ensure that you read the following information |
| 3 | +before issuing a pull request. Also refer back to this document as a checklist before issuing your pull request. |
| 4 | +This will save time for everyone._ |
| 5 | + |
| 6 | +# Before You Start |
| 7 | + |
| 8 | +## Understanding the Basics |
| 9 | + |
| 10 | +If you don't understand what a *pull request* is, or how to submit one, please refer to the [help documentation](https://help.github.com/articles/about-pull-requests/) |
| 11 | +provided by GitHub. |
| 12 | + |
| 13 | +## Is It Really a Support Issue |
| 14 | + |
| 15 | +If you aren't sure if your contribution is needed or necessary, please visit the [support forum][ml-users] before attempting to |
| 16 | +submit a pull request or a ticket. |
| 17 | + |
| 18 | +## Search Project Bug Base |
| 19 | + |
| 20 | +We require every commit, bug or enhancement to be tracked via our [bug database][]. It is useful, before you get too |
| 21 | +far, that you have checked that your issue isn't already known, otherwise addressed? If you think it is a valid defect or |
| 22 | +enhancement, please open a new ticket before submitting your pull request. |
| 23 | + |
| 24 | +## Discuss Non-Trivial Contributions with the Committers |
| 25 | + |
| 26 | +If your desired contribution is more than a non-trivial fix, you should discuss it on the |
| 27 | +[contributor's mailing list](mailto:odmdev_open_source_user@wwpdl.vnet.ibm.com). If you currently are not a member, you can request to be added. |
| 28 | + |
| 29 | + |
| 30 | +## New features |
| 31 | + |
| 32 | +Please raise any new feature requests on the project's issue tracker. |
| 33 | + |
| 34 | +### Coding standards |
| 35 | + |
| 36 | +Please ensure you follow the coding standards used throughout the existing code base. Some basic rules include: |
| 37 | + |
| 38 | + - All files must have the Apache license in the header. |
| 39 | + - Indent with 4 spaces, no tabs. No arguments. |
| 40 | + - Opening brace on same line as `if`/`for`/`function`/etc, closing brace on its own line. |
| 41 | + |
| 42 | +### Contributor License Agreement |
| 43 | + |
| 44 | +In order for us to accept pull requests, you must declare that you wrote the code or, at least, have the right to contribute it to the repo under the open source licence of the project in the repo. It's dead easy... |
| 45 | + |
| 46 | +1. Read this (from [developercertificate.org](http://developercertificate.org/)): |
| 47 | + |
| 48 | + ``` |
| 49 | + Developer Certificate of Origin |
| 50 | +Version 1.1 |
| 51 | +
|
| 52 | +Copyright (C) 2004, 2024 The Linux Foundation and its contributors. |
| 53 | +660 York Street, Suite 102, |
| 54 | +San Francisco, CA 94110 USA |
| 55 | +
|
| 56 | +Everyone is permitted to copy and distribute verbatim copies of this |
| 57 | +license document, but changing it is not allowed. |
| 58 | +
|
| 59 | +
|
| 60 | +Developer's Certificate of Origin 1.1 |
| 61 | +
|
| 62 | +By making a contribution to this project, I certify that: |
| 63 | +
|
| 64 | +(a) The contribution was created in whole or in part by me and I |
| 65 | + have the right to submit it under the open source license |
| 66 | + indicated in the file; or |
| 67 | +
|
| 68 | +(b) The contribution is based upon previous work that, to the best |
| 69 | + of my knowledge, is covered under an appropriate open source |
| 70 | + license and I have the right under that license to submit that |
| 71 | + work with modifications, whether created in whole or in part |
| 72 | + by me, under the same open source license (unless I am |
| 73 | + permitted to submit under a different license), as indicated |
| 74 | + in the file; or |
| 75 | +
|
| 76 | +(c) The contribution was provided directly to me by some other |
| 77 | + person who certified (a), (b) or (c) and I have not modified |
| 78 | + it. |
| 79 | +
|
| 80 | +(d) I understand and agree that this project and the contribution |
| 81 | + are public and that a record of the contribution (including all |
| 82 | + personal information I submit with it, including my sign-off) is |
| 83 | + maintained indefinitely and may be redistributed consistent with |
| 84 | + this project or the open source license(s) involved. |
| 85 | + ``` |
| 86 | + |
| 87 | +2. If you can certify that it is true, sign off your `git commit` with a message like this: |
| 88 | + ``` |
| 89 | + Signed-off-by: Laura Cowen <laura.cowen@email.com> |
| 90 | + ``` |
| 91 | + You must use your real name (no pseudonyms or anonymous contributions, sorry). |
| 92 | + |
| 93 | + Instead of typing that in every git commit message, your Git tools might let you automatically add the details for you. If you configure them to do that, when you issue the `git commit` command, just add the `-s` option. |
| 94 | + |
| 95 | +If you are an IBMer, please contact us directly as the contribution process is |
| 96 | +slightly different. |
| 97 | + |
| 98 | + |
| 99 | + |
| 100 | +## Test Cases |
| 101 | + |
| 102 | +If the pull request changes the functional behaviour or is fixing a defect, the unit test cases should be modified to |
| 103 | +reflect this. The committer reviewing your pull request is likely to request the appropriate changes in the test |
| 104 | +cases. |
| 105 | +It is expected that you will have tested your changes against the existing test cases and appropriate platforms prior to |
| 106 | +submitting your pull request. |
| 107 | + |
| 108 | +## Licensing |
| 109 | + |
| 110 | +All of your submissions are licensed under Apache 2.0 License. |
| 111 | + |
| 112 | +# Submitting a Pull Request |
| 113 | + |
| 114 | +The following are the general steps you should follow in creating a pull request. Subsequent pull requests only need |
| 115 | +to follow step 3 and beyond: |
| 116 | + |
| 117 | +1. Fork the repository on GitHub |
| 118 | +2. Clone the forked repository to your machine |
| 119 | +3. Create a "feature" branch in your local repository |
| 120 | +4. Make your changes and commit them to your local repository |
| 121 | +5. Rebase and push your commits to your GitHub remote fork/repository |
| 122 | +6. Issue a Pull Request to the official repository |
| 123 | +7. Your Pull Request is reviewed by a committer and merged into the repository |
| 124 | + |
| 125 | +*Note* While there are other ways to accomplish the steps using other tools, the examples here will assume the most |
| 126 | +actions will be performed via the `git` command line. |
| 127 | + |
| 128 | +## 1. Fork the Repository |
| 129 | + |
| 130 | +When logged into your GitHub account, and you are viewing one of the main repositories, you will see the *Fork* button. |
| 131 | +Clicking this button will show you which repositories your can fork to. Choose your own account. Once the process |
| 132 | +finishes, you will have your own repository that is "forked" from the GitHub one. |
| 133 | + |
| 134 | +Forking is a GitHub term and not a git term. Git is a wholly distributed source control system and simply worries |
| 135 | +about local and remote repositories and allows you to manage your code against them. GitHub then adds this additional |
| 136 | +layer of structure of how repositories can relate to each other. |
| 137 | + |
| 138 | +## 2. Clone the Forked Repository |
| 139 | + |
| 140 | +Once you have successfully forked your repository, you will need to clone it locally to your machine: |
| 141 | + |
| 142 | +```bash |
| 143 | +$ git clone git@github.com:username/odm-ondocker.git |
| 144 | +``` |
| 145 | + |
| 146 | +This will clone your fork to your current path in a directory named `odm-ondocker`. |
| 147 | + |
| 148 | +You should also setup the `upstream` repository. This will allow you to take changes from the "master" repository |
| 149 | +and merge them into your local clone and then push them to your GitHub fork: |
| 150 | + |
| 151 | +```bash |
| 152 | +$ cd odm-ondocker |
| 153 | +$ git remote add upstream git@github.com:lgrateau/odm-ondocker.git |
| 154 | +$ git fetch upstream |
| 155 | +``` |
| 156 | + |
| 157 | +Then you can retrieve upstream changes and rebase on them into your code like this: |
| 158 | + |
| 159 | +```bash |
| 160 | +$ git pull --rebase upstream master |
| 161 | +``` |
| 162 | + |
| 163 | +For more information on maintaining a fork, please see the GitHub Help article [Fork a Repo][] and information on |
| 164 | +[rebasing][] from git. |
| 165 | + |
| 166 | +## 3. Create a Branch |
| 167 | + |
| 168 | +The easiest workflow is to keep your master branch in sync with the upstream branch and do not locate any of your own |
| 169 | +commits in that branch. When you want to work on a new feature, you then ensure you are on the master branch and create |
| 170 | +a new branch from there. While the name of the branch can be anything, it can often be easy to use the ticket number |
| 171 | +you might be working on. For example: |
| 172 | + |
| 173 | +```bash |
| 174 | +$ git checkout -b t12 master |
| 175 | +Switched to a new branch 't12' |
| 176 | +``` |
| 177 | + |
| 178 | +You will then be on the feature branch. You can verify what branch you are on like this: |
| 179 | + |
| 180 | +```bash |
| 181 | +$ git status |
| 182 | +# On branch t12 |
| 183 | +nothing to commit, working directory clean |
| 184 | +``` |
| 185 | + |
| 186 | +## 4. Make Changes and Commit |
| 187 | + |
| 188 | +Now you just need to make your changes. Once you have finished your changes (and tested them) you need to commit them |
| 189 | +to your local repository (assuming you have staged your changes for committing): |
| 190 | + |
| 191 | +```bash |
| 192 | +$ git status |
| 193 | +# On branch t12345 |
| 194 | +# Changes to be committed: |
| 195 | +# (use "git reset HEAD <file>..." to unstage) |
| 196 | +# |
| 197 | +# modified: somefile.js |
| 198 | +# |
| 199 | +$ git commit -m "Corrects some defect, fixes #12" |
| 200 | +[t12 0000000] Corrects some defect, fixes #12 |
| 201 | + 1 file changed, 2 insertions(+), 2 deletions(-) |
| 202 | +``` |
| 203 | + |
| 204 | +## 5. Rebase and Push Changes |
| 205 | + |
| 206 | +If you have been working on your contribution for a while, the upstream repository may have changed. You may want to |
| 207 | +ensure your work is on top of the latest changes so your pull request can be applied cleanly: |
| 208 | + |
| 209 | +```bash |
| 210 | +$ git pull --rebase upstream master |
| 211 | +``` |
| 212 | + |
| 213 | +When you are ready to push your commit to your GitHub repository for the first time on this branch you would do the |
| 214 | +following: |
| 215 | + |
| 216 | +```bash |
| 217 | +$ git push -u origin t12 |
| 218 | +``` |
| 219 | + |
| 220 | +After the first time, you simply need to do: |
| 221 | + |
| 222 | +```bash |
| 223 | +$ git push |
| 224 | +``` |
| 225 | + |
| 226 | +## 6. Issue a Pull Request |
| 227 | + |
| 228 | +In order to have your commits merged into the main repository, you need to create a pull request. The instructions for |
| 229 | +this can be found in the GitHub Help Article [Creating a Pull Request][]. Essentially you do the following: |
| 230 | + |
| 231 | +1. Go to the site for your repository. |
| 232 | +2. Click the Pull Request button. |
| 233 | +3. Select the feature branch from your repository. |
| 234 | +4. Enter a title and description of your pull request. |
| 235 | +5. Review the commit and files changed tabs. |
| 236 | +6. Click `Send Pull Request` |
| 237 | + |
| 238 | +You will get notified about the status of your pull request based on your GitHub settings. |
| 239 | + |
| 240 | +## 7. Request is Reviewed and Merged |
| 241 | + |
| 242 | +Your request will be reviewed. It may be merged directly, or you may receive feedback or questions on your pull |
| 243 | +request. |
| 244 | + |
| 245 | + |
| 246 | +[help documentation]: http://help.github.com/send-pull-requests |
| 247 | +[bug database]: ../../issues |
| 248 | +[ml-users]: mailto:odmdev_open_source_user@wwpdl.vnet.ibm.com |
| 249 | +[Creating a Pull Request]: https://help.github.com/articles/creating-a-pull-request |
| 250 | +[Fork a Repo]: https://help.github.com/articles/fork-a-repo |
| 251 | +[coding guidelines]: https://github.com/ibm-js/sdk/blob/master/GUIDELINES.md |
| 252 | +[interactive rebase]: http://git-scm.com/book/en/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages |
| 253 | +[rebasing]: http://git-scm.com/book/en/Git-Branching-Rebasing |
0 commit comments