github.com/whiteCcinn/protobuf-go@v1.0.9/CONTRIBUTING.md (about) 1 # Contributing to Go Protocol Buffers 2 3 Go protocol buffers is an open source project and accepts contributions. 4 The source of truth for this repository is at 5 [go.googlesource.com/protobuf](https://go.googlesource.com/protobuf). 6 The code review tool used is 7 [Gerrit Code Review](https://www.gerritcodereview.com/). 8 At this time, we are unfortunately unable to accept GitHub pull requests. 9 10 11 ## Becoming a contributor 12 13 The first step is to configure your environment. 14 Please follow the steps outlined in 15 ["Becoming a contributor" (golang.org)](https://golang.org/doc/contribute.html#contributor) 16 as the setup for contributing to the `protobuf` project is identical 17 to that for contributing to the `go` project. 18 19 20 ## Before contributing code 21 22 The project welcomes submissions, but to make sure things are well coordinated 23 we ask that contributors discuss any significant changes before starting work. 24 Best practice is to connect your work to the 25 [issue tracker](https://github.com/golang/protobuf/issues), 26 either by filing a new issue or by claiming an existing issue. 27 28 29 ## Sending a change via Gerrit 30 31 The `protobuf` project performs development in Gerrit. 32 Below are the steps to send a change using Gerrit. 33 34 35 **Step 1:** Clone the Go source code: 36 ``` 37 $ git clone https://go.googlesource.com/protobuf 38 ``` 39 40 **Step 2:** Setup a Git hook: 41 Setup a hook to run the tests prior to submitting changes to Gerrit: 42 ``` 43 $ (cd protobuf/.git/hooks && echo -e '#!/bin/bash\n./test.bash' > pre-push && chmod a+x pre-push) 44 ``` 45 46 **Step 3:** Prepare changes in a new branch, created from the `master` branch. 47 To commit the changes, use `git codereview change`; 48 that will create or amend a single commit in the branch. 49 50 ``` 51 $ git checkout -b mybranch 52 $ [edit files...] 53 $ git add [files...] 54 $ git codereview change # create commit in the branch 55 $ [edit again...] 56 $ git add [files...] 57 $ git codereview change # amend the existing commit with new changes 58 $ [etc.] 59 ``` 60 61 **Step 4:** Send the changes for review to Gerrit using `git codereview mail`. 62 ``` 63 $ git codereview mail # send changes to Gerrit 64 ``` 65 66 **Step 5:** After a review, there may be changes that are required. 67 Do so by applying changes to the same commit and mail them to Gerrit again: 68 ``` 69 $ [edit files...] 70 $ git add [files...] 71 $ git codereview change # update same commit 72 $ git codereview mail # send to Gerrit again 73 ``` 74 75 When calling `git codereview mail`, it will call `git push` under the hood, 76 which will trigger the test hook that was setup in step 2. 77 78 The [Contribution Guidelines](https://golang.org/doc/contribute.html) for the 79 Go project provides additional details that are also relevant to 80 contributing to the Go `protobuf` project.