1# How to contribute
2
3We definitely welcome your patches and contributions to gRPC! Please read the gRPC
4organization's [governance rules](https://github.com/grpc/grpc-community/blob/master/governance.md)
5and [contribution guidelines](https://github.com/grpc/grpc-community/blob/master/CONTRIBUTING.md) before proceeding.
6
7If you are new to github, please start by reading [Pull Request howto](https://help.github.com/articles/about-pull-requests/)
8
9## Legal requirements
10
11In order to protect both you and ourselves, you will need to sign the
12[Contributor License Agreement](https://identity.linuxfoundation.org/projects/cncf).
13
14## Guidelines for Pull Requests
15How to get your contributions merged smoothly and quickly.
16
17- Create **small PRs** that are narrowly focused on **addressing a single
18  concern**. We often times receive PRs that are trying to fix several things at
19  a time, but only one fix is considered acceptable, nothing gets merged and
20  both author's & review's time is wasted. Create more PRs to address different
21  concerns and everyone will be happy.
22
23- The grpc package should only depend on standard Go packages and a small number
24  of exceptions. If your contribution introduces new dependencies which are NOT
25  in the [list](https://godoc.org/google.golang.org/grpc?imports), you need a
26  discussion with gRPC-Go authors and consultants.
27
28- For speculative changes, consider opening an issue and discussing it first. If
29  you are suggesting a behavioral or API change, consider starting with a [gRFC
30  proposal](https://github.com/grpc/proposal).
31
32- Provide a good **PR description** as a record of **what** change is being made
33  and **why** it was made. Link to a github issue if it exists.
34
35- Don't fix code style and formatting unless you are already changing that line
36  to address an issue. PRs with irrelevant changes won't be merged. If you do
37  want to fix formatting or style, do that in a separate PR.
38
39- Unless your PR is trivial, you should expect there will be reviewer comments
40  that you'll need to address before merging. We expect you to be reasonably
41  responsive to those comments, otherwise the PR will be closed after 2-3 weeks
42  of inactivity.
43
44- Maintain **clean commit history** and use **meaningful commit messages**. PRs
45  with messy commit history are difficult to review and won't be merged. Use
46  `rebase -i upstream/master` to curate your commit history and/or to bring in
47  latest changes from master (but avoid rebasing in the middle of a code
48  review).
49
50- Keep your PR up to date with upstream/master (if there are merge conflicts, we
51  can't really merge your change).
52
53- **All tests need to be passing** before your change can be merged. We
54  recommend you **run tests locally** before creating your PR to catch breakages
55  early on.
56  - `make all` to test everything, OR
57  - `make vet` to catch vet errors
58  - `make test` to run the tests
59  - `make testrace` to run tests in race mode
60  - optional `make testappengine` to run tests with appengine
61
62- Exceptions to the rules can be made if there's a compelling reason for doing so.
63