Howto Submit Code


ServiceComb is still growing and we hope that more will join us to share this. There are many ways to contribute:

  • Improve documents. Help us improve the documents on this site or the API documentation. For the documents on this site, you can find links Report a Doc Issue or Edit This Page on Github to start.
  • Implement feature request or fix bugs. You can find all the feature request and bug reports on the projects’ issues pages. Take Saga as an example, issues will be labeled as enhancement or bug, you can choose the ones you are interested in. Bug reports and new feature requests are also welcomed.

    Find Features

Run tests

Before submitting code, make sure that you have properly tested the functionality and verified the implementation according to the auto test section in README.

How to submit a PR

  It’s quite convenient to submit a Pull Request(PR) on Github. Take the apache/servicecomb-website as an example:

Fork repository

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

Fork Repository

Setup local repository

  • Clone the source code to local machine:

    git clone<your_github_name>/servicecomb-website.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/servicecomb-website as upstream remote:

    cd  servicecomb-website
    git remote add upstream
  • Check the local repository’s remotes

    git remote -v
    origin<your_github_name>/servicecomb-website.git (fetch)
    origin<your_github_name>/servicecomb-website.git (push)
    upstream (fetch)
    upstream (push)
  • Create a new branch to start working

    git checkout -b <your_branch_name>

    Note: replace <your_branch_name> with an actual branch name at your choice, like feature-foo/bugfix-bar Now you can start coding.

  • Push the changes to a remote repository

    git commit -a -m "<you_commit_message>"
    git push origin <your_branch_name>

 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:

New Pull Request fig-1 New pull request

Create Pull Request fig-2 Create pull request

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

    git push -f origin fix

    to push the resolved branch to remote origin