|
| 1 | +_Do you have a contribution? We welcome contributions, but please ensure that you read the following information |
| 2 | +before issuing a pull request. Also refer back to this document as a checklist before issuing your pull request. |
| 3 | +This will save time for everyone._ |
| 4 | + |
| 5 | +# Before You Start |
| 6 | + |
| 7 | +## Understanding the Basics |
| 8 | + |
| 9 | +If you don't understand what a *pull request* is, or how to submit one, please refer to the [help documentation][] |
| 10 | +provided by GitHub. |
| 11 | + |
| 12 | +## Is It Really a Support Issue |
| 13 | + |
| 14 | +If you aren't sure if your contribution is needed or necessary, please visit the [support forum][ml-users] before attempting to |
| 15 | +submit a pull request or a ticket. |
| 16 | + |
| 17 | +## Search Project Bug Base |
| 18 | + |
| 19 | +We require every commit, bug or enhancement to be tracked via our [bug database][]. It is useful, before you get too |
| 20 | +far, that you have checked that your issue isn't already known, otherwise addressed? If you think it is a valid defect or |
| 21 | +enhancement, please open a new ticket before submitting your pull request. |
| 22 | + |
| 23 | +## Discuss Non-Trivial Contributions with the Committers |
| 24 | + |
| 25 | +If your desired contribution is more than a non-trivial fix, you should discuss it on the |
| 26 | +[contributor's mailing list][ml-dev]. If you currently are not a member, you can request to be added. |
| 27 | + |
| 28 | +## Contributor License Agreement |
| 29 | + |
| 30 | +We require all contributions, to be covered under the Dojo Foundation's [Contributor License Agreement][cla]. This can |
| 31 | +be done electronically and essentially ensures that you are making it clear that your contributions are your |
| 32 | +contributions, you have the legal right to contribute and you are transferring the copyright of your works to the Dojo |
| 33 | +Foundation. |
| 34 | + |
| 35 | +If you are an unfamiliar contributor to the committer assessing your pull request, it is best to make it clear how |
| 36 | +you are covered by a CLA in the notes of the pull request. The committer will [verify][claCheck] your status. |
| 37 | + |
| 38 | +If your GitHub user id you are submitting your pull request from differs from the Dojo Community ID or e-mail address |
| 39 | +which you have signed your CLA under, you should specifically note what you have your CLA filed under (and for CCLA |
| 40 | +that you are listed under your companies authorised contributors). |
| 41 | + |
| 42 | +## Coding Style and Linting |
| 43 | + |
| 44 | +The project has a very specific coding style that are checked using this [jshintrc]. All pull requests should adhere to this. |
| 45 | + |
| 46 | +## Inline Documentation |
| 47 | + |
| 48 | +For now our inline API documentation is using [DojoDoc][]. Any pull request should ensure it has updated the inline |
| 49 | +documentation appropriately or added the appropriate inline documentation. |
| 50 | + |
| 51 | +## Test Cases |
| 52 | + |
| 53 | +If the pull request changes the functional behaviour or is fixing a defect, the unit test cases should be modified to |
| 54 | +reflect this. The committer reviewing your pull request is likely to request the appropriate changes in the test |
| 55 | +cases. The test case must be written using [Intern]. |
| 56 | + |
| 57 | +It is expected that you will have tested your changes against the existing test cases and appropriate platforms prior to |
| 58 | +submitting your pull request. |
| 59 | + |
| 60 | +## Licensing |
| 61 | + |
| 62 | +All of your submissions are licensed under "New" BSD license. |
| 63 | + |
| 64 | +# Submitting a Pull Request |
| 65 | + |
| 66 | +The following are the general steps you should follow in creating a pull request. Subsequent pull requests only need |
| 67 | +to follow step 3 and beyond: |
| 68 | + |
| 69 | +1. Fork the repository on GitHub |
| 70 | +2. Clone the forked repository to your machine |
| 71 | +3. Create a "feature" branch in your local repository |
| 72 | +4. Make your changes and commit them to your local repository |
| 73 | +5. Rebase and push your commits to your GitHub remote fork/repository |
| 74 | +6. Issue a Pull Request to the official repository |
| 75 | +7. Your Pull Request is reviewed by a committer and merged into the repository |
| 76 | + |
| 77 | +*Note* While there are other ways to accomplish the steps using other tools, the examples here will assume the most |
| 78 | +actions will be performed via the `git` command line. |
| 79 | + |
| 80 | +## 1. Fork the Repository |
| 81 | + |
| 82 | +When logged into your GitHub account, and you are viewing one of the main repositories, you will see the *Fork* button. |
| 83 | +Clicking this button will show you which repositories your can fork to. Choose your own account. Once the process |
| 84 | +finishes, you will have your own repository that is "forked" from the GitHub one. |
| 85 | + |
| 86 | +Forking is a GitHub term and not a git term. Git is a wholly distributed source control system and simply worries |
| 87 | +about local and remote repositories and allows you to manage your code against them. GitHub then adds this additional |
| 88 | +layer of structure of how repositories can relate to each other. |
| 89 | + |
| 90 | +## 2. Clone the Forked Repository |
| 91 | + |
| 92 | +Once you have successfully forked your repository, you will need to clone it locally to your machine: |
| 93 | + |
| 94 | +```bash |
| 95 | +$ git clone [email protected]:username/requirejs-dplugins.git |
| 96 | +``` |
| 97 | + |
| 98 | +This will clone your fork to your current path in a directory named `requirejs-dplugins`. |
| 99 | + |
| 100 | +You should also setup the `upstream` repository. This will allow you to take changes from the "master" repository |
| 101 | +and merge them into your local clone and then push them to your GitHub fork: |
| 102 | + |
| 103 | +```bash |
| 104 | +$ cd requirejs-dplugins |
| 105 | +$ git remote add upstream [email protected]:ibm-dojo/requirejs-dplugins.git |
| 106 | +$ git fetch upstream |
| 107 | +``` |
| 108 | + |
| 109 | +Then you can retrieve upstream changes and rebase on them into your code like this: |
| 110 | + |
| 111 | +```bash |
| 112 | +$ git pull --rebase upstream master |
| 113 | +``` |
| 114 | + |
| 115 | +For more information on maintaining a fork, please see the GitHub Help article [Fork a Repo][] and information on |
| 116 | +[rebasing][] from git. |
| 117 | + |
| 118 | +## 3. Create a Branch |
| 119 | + |
| 120 | +The easiest workflow is to keep your master branch in sync with the upstream branch and do not locate any of your own |
| 121 | +commits in that branch. When you want to work on a new feature, you then ensure you are on the master branch and create |
| 122 | +a new branch from there. While the name of the branch can be anything, it can often be easy to use the ticket number |
| 123 | +you might be working on. For example: |
| 124 | + |
| 125 | +```bash |
| 126 | +$ git checkout -b t12 master |
| 127 | +Switched to a new branch 't12' |
| 128 | +``` |
| 129 | + |
| 130 | +You will then be on the feature branch. You can verify what branch you are on like this: |
| 131 | + |
| 132 | +```bash |
| 133 | +$ git status |
| 134 | +# On branch t12 |
| 135 | +nothing to commit, working directory clean |
| 136 | +``` |
| 137 | + |
| 138 | +## 4. Make Changes and Commit |
| 139 | + |
| 140 | +Now you just need to make your changes. Once you have finished your changes (and tested them) you need to commit them |
| 141 | +to your local repository (assuming you have staged your changes for committing): |
| 142 | + |
| 143 | +```bash |
| 144 | +$ git status |
| 145 | +# On branch t12345 |
| 146 | +# Changes to be committed: |
| 147 | +# (use "git reset HEAD <file>..." to unstage) |
| 148 | +# |
| 149 | +# modified: somefile.js |
| 150 | +# |
| 151 | +$ git commit -m "Corrects some defect, fixes #12" |
| 152 | +[t12 0000000] Corrects some defect, fixes #12 |
| 153 | + 1 file changed, 2 insertions(+), 2 deletions(-) |
| 154 | +``` |
| 155 | + |
| 156 | +## 5. Rebase and Push Changes |
| 157 | + |
| 158 | +If you have been working on your contribution for a while, the upstream repository may have changed. You may want to |
| 159 | +ensure your work is on top of the latest changes so your pull request can be applied cleanly: |
| 160 | + |
| 161 | +```bash |
| 162 | +$ git pull --rebase upstream master |
| 163 | +``` |
| 164 | + |
| 165 | +When you are ready to push your commit to your GitHub repository for the first time on this branch you would do the |
| 166 | +following: |
| 167 | + |
| 168 | +```bash |
| 169 | +$ git push -u origin t12 |
| 170 | +``` |
| 171 | + |
| 172 | +After the first time, you simply need to do: |
| 173 | + |
| 174 | +```bash |
| 175 | +$ git push |
| 176 | +``` |
| 177 | + |
| 178 | +## 6. Issue a Pull Request |
| 179 | + |
| 180 | +In order to have your commits merged into the main repository, you need to create a pull request. The instructions for |
| 181 | +this can be found in the GitHub Help Article [Creating a Pull Request][]. Essentially you do the following: |
| 182 | + |
| 183 | +1. Go to the site for your repository. |
| 184 | +2. Click the Pull Request button. |
| 185 | +3. Select the feature branch from your repository. |
| 186 | +4. Enter a title and description of your pull request. |
| 187 | +5. Review the commit and files changed tabs. |
| 188 | +6. Click `Send Pull Request` |
| 189 | + |
| 190 | +You will get notified about the status of your pull request based on your GitHub settings. |
| 191 | + |
| 192 | +## 7. Request is Reviewed and Merged |
| 193 | + |
| 194 | +Your request will be reviewed. It may be merged directly, or you may receive feedback or questions on your pull |
| 195 | +request. |
| 196 | + |
| 197 | + |
| 198 | +[help documentation]: http://help.github.com/send-pull-requests |
| 199 | +[bug database]: ../../issues |
| 200 | +[ml-users]: http://dojotoolkit.org/community/ |
| 201 | +[ml-dev]: http://mail.dojotoolkit.org/mailman/listinfo/dojo-contributors |
| 202 | +[cla]: http://dojofoundation.org/about/cla |
| 203 | +[claCheck]: http://dojofoundation.org/about/claCheck |
| 204 | +[Creating a Pull Request]: https://help.github.com/articles/creating-a-pull-request |
| 205 | +[Fork a Repo]: https://help.github.com/articles/fork-a-repo |
| 206 | +[jshintrc]: ./.jshintrc |
| 207 | +[DojoDoc]: http://dojotoolkit.org/reference-guide/developer/markup.html |
| 208 | +[Intern]: http://theintern.io/ |
| 209 | +[interactive rebase]: http://git-scm.com/book/en/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages |
| 210 | +[rebasing]: http://git-scm.com/book/en/Git-Branching-Rebasing |
0 commit comments