Skip to content

Contribution Process

Baohua Yang edited this page Sep 17, 2022 · 20 revisions

On Linux, you can use

sudo apt-get update
sudo apt-get install git -y
# Configure the username, replace First Last:
git config --global user.name "First Last"
#Configure the email, replace [email protected]:
git config --global user.email "[email protected]"

On macOS, you can use

$ brew install hub

On Linux, you can use

sudo snap install hub --classic

hub requires git, and can replace its commands for most cases.

Clone and Fork the project

$ hub clone https://github.com/hyperledger/cello.git
$ cd cello
$ hub fork --remote-name=origin
$ git branch main --set-upstream-to origin/main

If ask for the github password, provide the access token as password. Now there will be a cello repo under your own github account.

Check the .git/config file, there will be two remotes:

  • origin: Your own repo, and the main branch will track it;
  • upstream: The official hyperledger/cello repo.

You only need to do this forking once.

Contribute code

Sync your repo with the official one.

Checkout a new feature branch, commit the code change and push to your repo. Suppose your issue number is xxx.

$ git fetch upstream main && git rebase FETCH_HEAD && git push -f origin
$ hub checkout -b issue-xxx
$ # do the code change at fix_bug branch
$ hub commit -a -s
$ make check # checking code format
$ hub push --set-upstream origin issue-xxx

Commit message policy

[#issue-no] Short Title

Detailed Commit Message

Close #issue-no

And if you want to auto close related issue, can see the closing-issues-using-keywords.

Create a pull request

$ hub pull-request [-b upstream:main] [-r <REVIEWERS> ]

After review an approved, you can delete the issue branch.

$ git fetch upstream main && git rebase FETCH_HEAD && git push -f origin
$ git push -d origin issue-xxx
$ git branch -d issue-xxx