|
| 1 | +# Contribution Guide |
| 2 | + |
| 3 | +* [Before you get started](#before-you-get-started) |
| 4 | + * [Code of Conduct](#code-of-conduct) |
| 5 | +* [Your First Contribution](#your-first-contribution) |
| 6 | + * [Find a good first topic](#find-a-good-first-topic) |
| 7 | +* [Setting up your development environment](#setting-up-your-development-environment) |
| 8 | + * [Fork the project](#fork-the-project) |
| 9 | + * [Clone the project](#clone-the-project) |
| 10 | + * [New branch for a new code](#new-branch-for-a-new-code) |
| 11 | + * [Test](#test) |
| 12 | + * [Commit and push](#commit-and-push) |
| 13 | + * [Create a Pull Request](#create-a-pull-request) |
| 14 | + * [Sign the CLA](#sign-the-cla) |
| 15 | + * [Get a code review](#get-a-code-review) |
| 16 | + |
| 17 | +## Before you get started |
| 18 | + |
| 19 | +### Code of Conduct |
| 20 | + |
| 21 | +Please make sure to read and observe our [Code of Conduct](./CODE_OF_CONDUCT.md). |
| 22 | + |
| 23 | +## Your First Contribution |
| 24 | + |
| 25 | +### Find a good first topic |
| 26 | + |
| 27 | +You can start by finding an existing issue with the |
| 28 | +[good first issue](https://github.com/dgraph-io/badger/labels/good%20first%20issue) or [help wanted](https://github.com/dgraph-io/badger/labels/help%20wanted) labels. These issues are well suited for new contributors. |
| 29 | + |
| 30 | + |
| 31 | +## Setting up your development environment |
| 32 | + |
| 33 | +Badger uses [`Go Modules`](https://github.com/golang/go/wiki/Modules) |
| 34 | +to manage dependencies. The version of Go should be **1.12** or above. |
| 35 | + |
| 36 | +### Fork the project |
| 37 | + |
| 38 | +- Visit https://github.com/dgraph-io/badger |
| 39 | +- Click the `Fork` button (top right) to create a fork of the repository |
| 40 | + |
| 41 | +### Clone the project |
| 42 | + |
| 43 | +```sh |
| 44 | +$ git clone https://github.com/$GITHUB_USER/badger |
| 45 | +$ cd badger |
| 46 | +$ git remote add upstream git@github.com:dgraph-io/badger.git |
| 47 | + |
| 48 | +# Never push to the upstream master |
| 49 | +git remote set-url --push upstream no_push |
| 50 | +``` |
| 51 | + |
| 52 | +### New branch for a new code |
| 53 | + |
| 54 | +Get your local master up to date: |
| 55 | + |
| 56 | +```sh |
| 57 | +$ git fetch upstream |
| 58 | +$ git checkout master |
| 59 | +$ git rebase upstream/master |
| 60 | +``` |
| 61 | + |
| 62 | +Create a new branch from the master: |
| 63 | + |
| 64 | +```sh |
| 65 | +$ git checkout -b my_new_feature |
| 66 | +``` |
| 67 | + |
| 68 | +And now you can finally add your changes to project. |
| 69 | + |
| 70 | +### Test |
| 71 | + |
| 72 | +Build and run all tests: |
| 73 | + |
| 74 | +```sh |
| 75 | +$ ./test.sh |
| 76 | +``` |
| 77 | + |
| 78 | +### Commit and push |
| 79 | + |
| 80 | +Commit your changes: |
| 81 | + |
| 82 | +```sh |
| 83 | +$ git commit |
| 84 | +``` |
| 85 | + |
| 86 | +When the changes are ready to review: |
| 87 | + |
| 88 | +```sh |
| 89 | +$ git push origin my_new_feature |
| 90 | +``` |
| 91 | + |
| 92 | +### Create a Pull Request |
| 93 | + |
| 94 | +Just open `https://github.com/$GITHUB_USER/badger/pull/new/my_new_feature` and |
| 95 | +fill the PR description. |
| 96 | + |
| 97 | +### Sign the CLA |
| 98 | + |
| 99 | +Click the **Sign in with Github to agree** button to sign the CLA. [An example](https://cla-assistant.io/dgraph-io/badger?pullRequest=1377). |
| 100 | + |
| 101 | +### Get a code review |
| 102 | + |
| 103 | +If your pull request (PR) is opened, it will be assigned to one or more |
| 104 | +reviewers. Those reviewers will do a code review. |
| 105 | + |
| 106 | +To address review comments, you should commit the changes to the same branch of |
| 107 | +the PR on your fork. |
0 commit comments