2018-11-13 12:38:37 -05:00
|
|
|
<!--
|
|
|
|
~ Licensed to the Apache Software Foundation (ASF) under one
|
|
|
|
~ or more contributor license agreements. See the NOTICE file
|
|
|
|
~ distributed with this work for additional information
|
|
|
|
~ regarding copyright ownership. The ASF licenses this file
|
|
|
|
~ to you under the Apache License, Version 2.0 (the
|
|
|
|
~ "License"); you may not use this file except in compliance
|
|
|
|
~ with the License. You may obtain a copy of the License at
|
|
|
|
~
|
|
|
|
~ http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
~
|
|
|
|
~ Unless required by applicable law or agreed to in writing,
|
|
|
|
~ software distributed under the License is distributed on an
|
|
|
|
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
~ KIND, either express or implied. See the License for the
|
|
|
|
~ specific language governing permissions and limitations
|
|
|
|
~ under the License.
|
|
|
|
-->
|
|
|
|
|
2015-01-28 16:05:15 -05:00
|
|
|
# How to Contribute
|
|
|
|
|
2015-02-03 13:15:20 -05:00
|
|
|
When submitting a pull request (PR), please use the following guidelines:
|
|
|
|
|
2015-11-20 00:30:28 -05:00
|
|
|
- Make sure your code respects existing formatting conventions. In general, follow
|
2016-06-24 18:27:50 -04:00
|
|
|
the same coding style as the code that you are modifying.
|
2019-04-17 09:27:14 -04:00
|
|
|
- For Intellij you can import our code style settings xml: [`druid_intellij_formatting.xml`](
|
|
|
|
https://github.com/apache/incubator-druid/raw/master/dev/druid_intellij_formatting.xml).
|
|
|
|
- For Eclipse you can import our code style settings xml: [`eclipse_formatting.xml`](
|
|
|
|
https://github.com/apache/incubator-druid/raw/master/dev/eclipse_formatting.xml).
|
2015-11-20 00:30:28 -05:00
|
|
|
- Do add/update documentation appropriately for the change you are making.
|
2018-04-30 14:25:45 -04:00
|
|
|
- If you are introducing a new feature you may want to first write about your idea
|
2019-04-17 09:27:14 -04:00
|
|
|
for feedback to [dev@druid.apache.org](https://lists.apache.org/list.html?dev@druid.apache.org). Or create an issue
|
|
|
|
using "Feature/Change" template. Non-trivial features should include unit tests covering the new functionality. Open
|
|
|
|
a "Proposal" issue for large changes.
|
2015-11-20 00:30:28 -05:00
|
|
|
- Bugfixes should include a unit test or integration test reproducing the issue.
|
|
|
|
- Do not use author tags/information in the code.
|
2015-02-03 13:15:20 -05:00
|
|
|
- Try to keep pull requests short and submit separate ones for unrelated
|
|
|
|
features, but feel free to combine simple bugfixes/tests into one pull request.
|
2019-08-22 17:14:24 -04:00
|
|
|
- If you are adding or updating a dependency, be sure to update the version, license, or notice information in
|
|
|
|
[licenses.yaml](https://github.com/apache/incubator-druid/blob/master/licenses.yaml) as appropriate to help ease
|
|
|
|
LICENSE and NOTICE management for ASF releases.
|
2015-02-03 13:15:20 -05:00
|
|
|
|
2019-04-17 09:27:14 -04:00
|
|
|
You can find more developers' resources in [`dev/`](dev) directory.
|
|
|
|
|
2015-01-28 16:05:15 -05:00
|
|
|
## GitHub Workflow
|
|
|
|
|
2018-08-30 12:56:26 -04:00
|
|
|
1. Fork the apache/incubator-druid repository into your GitHub account
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2018-08-30 12:56:26 -04:00
|
|
|
https://github.com/apache/incubator-druid/fork
|
2015-02-03 13:15:20 -05:00
|
|
|
|
|
|
|
1. Clone your fork of the GitHub repository
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2017-06-16 22:27:46 -04:00
|
|
|
```sh
|
2019-09-12 22:48:01 -04:00
|
|
|
git clone git@github.com:<username>/incubator-druid.git
|
2017-06-16 22:27:46 -04:00
|
|
|
```
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2017-06-16 22:27:46 -04:00
|
|
|
replace `<username>` with your GitHub username.
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2015-02-03 13:15:20 -05:00
|
|
|
1. Add a remote to keep up with upstream changes
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2017-06-16 22:27:46 -04:00
|
|
|
```
|
2018-08-30 12:56:26 -04:00
|
|
|
git remote add upstream https://github.com/apache/incubator-druid.git
|
2017-06-16 22:27:46 -04:00
|
|
|
```
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2017-06-16 22:27:46 -04:00
|
|
|
If you already have a copy, fetch upstream changes
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2017-06-16 22:27:46 -04:00
|
|
|
```
|
|
|
|
git fetch upstream master
|
|
|
|
```
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2015-02-03 13:15:20 -05:00
|
|
|
1. Create a feature branch to work in
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2017-06-16 22:27:46 -04:00
|
|
|
```
|
|
|
|
git checkout -b feature-xxx remotes/upstream/master
|
|
|
|
```
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2017-06-16 22:27:46 -04:00
|
|
|
1. _Before submitting a pull request_ periodically rebase your changes
|
|
|
|
(but don't do it when a pull request is already submitted)
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2017-06-16 22:27:46 -04:00
|
|
|
```
|
|
|
|
git pull --rebase upstream master
|
|
|
|
```
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2017-03-21 13:06:11 -04:00
|
|
|
1. Before submitting a pull request, combine ("squash") related commits into a single one
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2017-06-16 22:27:46 -04:00
|
|
|
```
|
|
|
|
git rebase -i upstream/master
|
|
|
|
```
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2017-06-16 22:27:46 -04:00
|
|
|
This will open your editor and allow you to re-order commits and merge them:
|
|
|
|
- Re-order the lines to change commit order (to the extent possible without creating conflicts)
|
|
|
|
- Prefix commits using `s` (squash) or `f` (fixup) to merge extraneous commits.
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2015-02-03 13:15:20 -05:00
|
|
|
1. Submit a pull-request
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2017-06-16 22:27:46 -04:00
|
|
|
```
|
|
|
|
git push origin feature-xxx
|
|
|
|
```
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2017-06-16 22:27:46 -04:00
|
|
|
Go to your Druid fork main page
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2017-06-16 22:27:46 -04:00
|
|
|
```
|
2019-09-12 22:48:01 -04:00
|
|
|
https://github.com/<username>/incubator-druid
|
2017-06-16 22:27:46 -04:00
|
|
|
```
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2017-06-16 22:27:46 -04:00
|
|
|
If you recently pushed your changes GitHub will automatically pop up a
|
|
|
|
`Compare & pull request` button for any branches you recently pushed to. If you
|
|
|
|
click that button it will automatically offer you to submit your pull-request
|
2018-08-30 12:56:26 -04:00
|
|
|
to the apache/incubator-druid repository.
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2017-06-16 22:27:46 -04:00
|
|
|
- Give your pull-request a meaningful title.
|
|
|
|
- In the description, explain your changes and the problem they are solving.
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2015-02-03 13:15:20 -05:00
|
|
|
1. Addressing code review comments
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2017-06-16 22:27:46 -04:00
|
|
|
Address code review comments by committing changes and pushing them to your feature
|
|
|
|
branch.
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2017-06-16 22:27:46 -04:00
|
|
|
```
|
|
|
|
git push origin feature-xxx
|
|
|
|
```
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2017-06-16 22:27:46 -04:00
|
|
|
### If your pull request shows conflicts with master
|
|
|
|
If your pull request shows conflicts with master, merge master into your feature branch:
|
|
|
|
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2015-02-03 13:15:20 -05:00
|
|
|
```
|
2017-06-16 22:27:46 -04:00
|
|
|
git merge upstream/master
|
|
|
|
```
|
|
|
|
|
|
|
|
and resolve the conflicts. After resolving conflicts, push your branch again:
|
|
|
|
|
|
|
|
```
|
|
|
|
git push origin feature-xxx
|
2015-02-03 13:15:20 -05:00
|
|
|
```
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2017-06-16 22:27:46 -04:00
|
|
|
_Avoid rebasing and force pushes after submitting a pull request,_ since these make it
|
2017-03-21 13:06:11 -04:00
|
|
|
difficult for reviewers to see what you've changed in response to their reviews. The Druid
|
|
|
|
committer that merges your change will rebase and squash it into a single commit before
|
|
|
|
committing it to master.
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2019-04-17 09:27:14 -04:00
|
|
|
## FAQ
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2015-09-29 14:22:35 -04:00
|
|
|
### Help! I merged changes from upstream and cannot figure out how to resolve conflicts when rebasing!
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2015-09-29 14:22:35 -04:00
|
|
|
Never fear! If you occasionally merged upstream/master, here is another way to squash your changes into a single commit:
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2015-02-03 13:15:20 -05:00
|
|
|
1. First, rename your existing branch to something else, e.g. `feature-xxx-unclean`
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2015-02-03 13:15:20 -05:00
|
|
|
```
|
|
|
|
git branch -m feature-xxx-unclean
|
|
|
|
```
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2015-02-03 13:15:20 -05:00
|
|
|
1. Checkout a new branch with the original name `feature-xxx` from upstream. This branch will supercede our old one.
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2015-02-03 13:15:20 -05:00
|
|
|
```
|
|
|
|
git checkout -b feature-xxx upstream/master
|
|
|
|
```
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2015-02-03 13:15:20 -05:00
|
|
|
1. Then merge your changes in your original feature branch `feature-xxx-unclean` and create a single commit.
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2015-02-03 13:15:20 -05:00
|
|
|
```
|
|
|
|
git merge --squash feature-xxx-unclean
|
|
|
|
git commit
|
|
|
|
```
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2015-09-29 14:22:35 -04:00
|
|
|
1. You can now submit this new branch and create or replace your existing pull request.
|
2015-01-28 16:05:15 -05:00
|
|
|
|
2015-02-03 13:15:20 -05:00
|
|
|
```
|
|
|
|
git push origin [--force] feature-xxx:feature-xxx
|
|
|
|
```
|