# Howto Submit Code

# Contribution

IoTDB invites developers to participate in the construction of open source projects

You can check issues and participate in the resolution, or make other improvements.

After submitting the pr, after passing the Travis-CI test and Sonar code quality inspection, at least one Committer agrees and the code does not conflict, you can merge

# PR guide

You can easily submit Pull Request (PR) on Github, the following will use this website project apache / incubator-iotdb as an example (if it is another project, please replace the project name incubator-iotdb)

# Fork repository

Visit the apache/incubator-iotdb project’s github page, click Fork button on the right left cornor.

# Setup local repository

  • Clone the source code to local machine:
git clone https://github.com/<your_github_name>/incubator-iotdb.git

Note: substitute <your_github_name> with your github username.

After the clone is done, the origin remote will point to the default branch of the cloned repository.

  • add apache/incubator-iotdb as upstream remote:
cd  incubator-iotdb
git remote add upstream https://github.com/apache/incubator-iotdb.git
  • Check the local repository’s remotes
git remote -v
origin https://github.com/<your_github_name>/incubator-iotdb.git (fetch)
origin    https://github.com/<your_github_name>/incubator-iotdb.git(push)
upstream  https://github.com/apache/incubator-iotdb.git (fetch)
upstream  https://github.com/apache/incubator-iotdb.git (push)
  • Create a new branch to start working:(e.g. fix)
git checkout -b fix

You can make code changes after creation.

  • Push the changes to a remote repository:(e.g. fix)
git commit -a -m "<you_commit_message>"
git push origin fix

For more on git usages, please visitGit tutorial.

# Create PR

Goto your github page, find the apache/servicecomb-website project, swich to the branch you just pushed, click on New pull request and then Create pull request, see the image below:If you solve the issues, you need to add [IOTDB-xxx] at the beginning,see the image below:

Congrautulations, now you have succesfully submitted a PR. For more on PR, please read collaborating-with-issues-and-pull-requests

# Resolve conflicts

When a same piece of file is edited by multiple person simultaneously, conflicts can occur. It can be resolved as follow:

1:Switch to the master branch

git checkout master

2:Pull the upstream’s master branch

git pull upstream master

3:Switch back to the branch we are working on(e.g. fix)

git checkout fix

4:Rebase the working branch onto the master branch

git rebase -i master

A list of commits will be listed on your text editor. Normally we can just save and exit. Git will now apply the commits one by one onto the master branch until it encounters a conflict. When this happens, the rebase process is paused. We need to resolve the conflicts, then execute

git add .
git rebase --continue

Repeat this process until all commits are successfully applied. And finally run

5:to push the resolved branch to remote origin

git push -f origin fix

The code of conduct is derived fromApache ServiceComb

Copyright © 2020 The Apache Software Foundation.
Apache and the Apache feather logo are trademarks of The Apache Software Foundation

Disclaimer: Apache IoTDB (incubating) is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.