Thanks for taking the time to contribute! As an open source project, HugeGraph is looking forward to be contributed from everyone, and we are also grateful to all of the contributors.
The following is a contribution guide for HugeGraph:
We can contribute by reporting issues, submitting code patches or any other feedback.
Before submitting the code, we need to do some preparation:
-
Sign up or login to GitHub: https://github.com
-
Fork HugeGraph repo from GitHub: https://github.com/hugegraph/hugegraph/fork
-
Clone code from fork repo to local: https://github.com/${GITHUB_USER_NAME}/hugegraph
# clone code from remote to local repo git clone https://github.com/${GITHUB_USER_NAME}/hugegraph
-
Configure local HugeGraph repo
cd hugegraph # add upstream to synchronize the latest code git remote add hugegraph https://github.com/hugegraph/hugegraph # set name and email to push code to github git config user.name "{full-name}" # like "Jermy Li" git config user.email "{email-address-of-github}" # like "jermy@gmail.com"
-
Sign the HugeGraph CLA: https://cla-assistant.io/hugegraph/hugegraph
Optional: You can use Github desktop to greatly simplify the commit and update process.
If you encounter bugs or have any questions, please go to GitHub Issues to report them and feel free to create an issue.
Please don't use master branch for development. Instead we should create a new branch:
# checkout master branch
git checkout master
# pull the latest code from official hugegraph
git pull hugegraph
# create new branch: bugfix-branch
git checkout -b bugfix-branch
Assume that we need to modify some files like "HugeGraph.java" and "HugeFactory.java":
# modify code to fix a bug
vim hugegraph-core/src/main/java/com/baidu/hugegraph/HugeGraph.java
vim hugegraph-core/src/main/java/com/baidu/hugegraph/HugeFactory.java
# run test locally (optional)
mvn test -Pcore-test,memory
Note: In order to be consistent with the code style easily, if you use IDEA as your IDE, you can directly import our code style configuration file.
After the code has been completed, we submit them to the local git repo:
# add files to local git index
git add hugegraph-core/src/main/java/com/baidu/hugegraph/HugeGraph.java
git add hugegraph-core/src/main/java/com/baidu/hugegraph/HugeFactory.java
# commit to local git repo
git commit
Please edit the commit message after running git commit
, we can explain what and how to fix a bug or implement a feature, the following is an example:
Fix bug: run deploy multiple times
fix #ISSUE_ID
Please remember to fill in the issue id, which was generated by GitHub after issue creation.
Push the local commit to GitHub fork repo:
# push the local commit to fork repo
git push origin bugfix-branch:bugfix-branch
Go to the web page of GitHub fork repo, there would be a chance to create a Pull Request after pushing to a new branch, just click button "Compare & pull request" to do it. Then edit the description for proposed changes, which can just be copied from the commit message.
Maintainers will start the code review after all the automatic checks are passed:
- Check: Contributor License Agreement is signed
- Check: Travis CI builds is passed (automatically Test and Deploy)
The commit will be accepted and merged if there is no problem after review.
Please click on "Details" to find the problem if any check does not pass.
If there are checks not passed or changes requested, then continue to modify the code and push again.
If we have not passed the review, don't be discouraged. Usually a commit needs to be reviewed several times before being accepted! Please follow the review comments and make further changes.
After the further changes, we submit them to the local repo:
# commit all updated files in amend mode
# instead of creating a new commit
git commit -a --amend
If there are conflicts that prevent the code from being merged, we need to rebase on master branch:
# synchronize the latest code git checkout master git pull hugegraph # rebase on master git checkout bugfix-branch git rebase -i master
And push it to GitHub fork repo again:
# force push the local commit to fork repo
git push -f origin bugfix-branch:bugfix-branch
Github will automatically update the Pull Request after we push it, just wait for code review.
Any question please contact to us through hugegraph@googlegroups.com or other contact information.