Nacos Contributing Flow

This contribution flow is applicable to all Nacos community content, including but not limited to Nacos, Nacos wiki/doc, Nacos SDK.

The following use contributing Nacos as an example to explain the contribution flow in detail.

1. Fork Alibaba/Nacos repository to your Github.

2. Clone your fork Nacos repository to local.

  1. git clone ${your fork nacos repo address}
  2. cd nacos

3. Add Alibaba/Nacos repository as upstream repo.

  1. git remote add upstream https://github.com/alibaba/nacos.git
  2. git remote -v
  3. origin ${your fork nacos repo address} (fetch)
  4. origin ${your fork nacos repo address} (push)
  5. upstream https://github.com/alibaba/nacos.git (fetch)
  6. upstream https://github.com/alibaba/nacos.git (push)
  7. git fetch origin
  8. git fetch upstream

4. Choose a basic branch of development usually upstream/develop,and create a new branch based on it.

  1. (checkout branch from remote repo to local
  2. git checkout -b upstream-develop upstream/develop
  3. (Create a development branch from the local branch, usually using the issue number as the development branch name
  4. git checkout -b develop-issue#${issue-number}

5. Do your change in your local develop branch.

First please make sure you read and set the Nacos code style correctly, please read the related content Code of Conduct.

When making changes, please ensure that the changes on this branch are only relevant to the issue, and try to be as small as possible, so that only one thing is modified in one branch, and only one thing is modified in one PR.

At the same time, please use your English description as much as possible for your commits. It is mainly described by predicate + object, such as: Fix xxx problem/bug.

Some simple commits can be described using For xxx, such as: For codestyle.

If the commits is related to an ISSUE, you can add the ISSUE number as a prefix, such as: For #10000, Fix xxx problem/bug.

6. Rebase develop branch

When you make changes, other people’s changes may have commited and merged. At this time, there may be conflicts. Please use the rebase command to merge and resolve. There are two main benefits:

  1. Your submission record will be very clean, without the words Merge xxxx branch.
  2. After rebase, the commit log of your branch is also a single chain, it is easier to check back.
  1. git fetch upstream
  2. git rebase -i upstream/develop

OR

  1. git checkout upstream-develop
  2. git pull
  3. git checkout develop-issue#${issue-number}
  4. git rebase -i upstream-develop

If you are using Intellij IDEA, it is recommended to use the IDE version control, which has a more convenient visual panel to resolve conflicts and squash operations.

7. Push your develop branch to your fork repository.

  1. git push origin develop-issue#${issue-number}

8. Create Pull Request according to the pull request template

pull request template

The Nacos community will review your Pull Request and may propose comments.

You can return to step 5 to modify code according to the comments and use step 6 to resubmit.

If you are prompted that there are conflicts when you push to fork repo again, Force push to your fork branch will be ok. The reason of conflicts is that the commit ID has changed after you rebase with others changes.

9. If no more problem, Nacos community will merge your PR. Congratulations for you becoming a official contributor of Nacos.