# Howto Submit Code

# Contribution

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

You can check issues (opens new window) 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) (opens new window) on Github, the following will use this website project apache/iotdb (opens new window) as an example (if it is another project, please replace the project name iotdb)

# Fork repository

Visit the apache/iotdb project’s github page (opens new window), 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>/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/iotdb as upstream remote:
cd  iotdb
git remote add upstream https://github.com/apache/iotdb.git
  • Check the local repository’s remotes
git remote -v
origin https://github.com/<your_github_name>/iotdb.git (fetch)
origin    https://github.com/<your_github_name>/iotdb.git(push)
upstream  https://github.com/apache/iotdb.git (fetch)
upstream  https://github.com/apache/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 (opens new window).

# Submission Considerations

When submitting code on git, you should pay attention to:

  • Keep the repository clean:

    • Do not submit binary files, so that the size of the repository only increases due to changes in the code.

    • Do not submit generated code.

  • The log should have meaning:

    • Title is jira numbered: [IOTDB-jira number]

    • Title is the issue number of GitHub: [ISSUE-issue number]

      • Write #XXXX in the content for association.

# 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 (opens new window), 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 (opens new window)

# 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 (opens new window)

Found Error, Edit this page on GitHub (opens new window)

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

Have a question? Connect with us on QQ, WeChat, or Slack. Join the community now.

We use Google Analytics to collect anonymous, aggregated usage information.