Debian Codegraph @

CONTRIBUTING.md

raw symbols SCIP
1 # Contributing to `vmw-guestinfo`
2
3 ## Getting started
4
5 First, fork the repository on GitHub to your personal account.
6
7 Note that `GOPATH` can be any directory, the example below uses `$HOME/vmw-guestinfo`.
8 Change `$USER` below to your Github username if they are not the same.
9
10 ```console
11 $ export GOPATH=$HOME/vmw-guestinfo
12 $ go get github.com/vmware/vmw-guestinfo
13
14 $ cd $GOPATH/src/github.com/vmware/vmw-guestinfo
15 $ git config push.default nothing # anything to avoid pushing to vmware/vmw-guestinfo by default
16 $ git remote rename origin vmware
17 $ git remote add $USER [email protected]:$USER/vmw-guestinfo.git
18 $ git fetch $USER
19 ```
20
21 ## Contribution Flow
22
23 This is a rough outline of what a contributor's workflow looks like:
24
25 - Create an issue describing the feature/fix
26 - Create a topic branch from where you want to base your work.
27 - Make commits of logical units.
28 - Make sure your commit messages are in the proper format (see below).
29 - Push your changes to a topic branch in your fork of the repository.
30 - Submit a pull request to `vmware/vmw-guestinfo`.
31
32 See [below](#format-of-the-commit-message) for details on commit best practices
33 and **supported prefixes**, e.g. `govc: <message>`.
34
35 ### Example 1 - Fix a Bug in `vmw-guestinfo`
36
37 ```console
38 $ git checkout -b issue-<number> vmware/master
39 $ git add <files>
40 $ git commit -m "fix: ..." -m "Closes: #<issue-number>"
41 $ git push $USER issue-<number>
42 ```
43
44 ### Example 2 - Add a new (non-breaking) API to `vmw-guestinfo`
45
46 ```console
47 $ git checkout -b issue-<number> vmware/master
48 $ git add <files>
49 $ git commit -m "Add API ..." -m "Closes: #<issue-number>"
50 $ git push $USER issue-<number>
51 ```
52
53 ### Example 3 - Document Breaking (API) Changes
54
55 Breaking changes, e.g. to the `vmw-guestinfo` APIs, are highlighted in the `CHANGELOG`
56 and release notes when the keyword `BREAKING:` is used in the commit message
57 body.
58
59 The text after `BREAKING:` is used in the corresponding highlighted section.
60 Thus these details should be stated at the body of the commit message.
61 Multi-line strings are supported.
62
63 ```console
64 $ git checkout -b issue-<number> vmware/master
65 $ git add <files>
66 $ cat << EOF | git commit -F -
67 Add ctx to funcXYZ
68
69 This commit introduces context.Context to function XYZ
70 Closes: #1234
71
72 BREAKING: Add ctx to funcXYZ()
73 EOF
74
75 $ git push $USER issue-<number>
76 ```
77
78 ### Stay in sync with Upstream
79
80 When your branch gets out of sync with the vmware/master branch, use the
81 following to update (rebase):
82
83 ```console
84 $ git checkout issue-<number>
85 $ git fetch -a
86 $ git rebase vmware/master
87 $ git push --force-with-lease $USER issue-<number>
88 ```
89
90 ### Updating Pull Requests
91
92 If your PR fails to pass CI or needs changes based on code review, you'll most
93 likely want to squash these changes into existing commits.
94
95 If your pull request contains a single commit or your changes are related to the
96 most recent commit, you can simply amend the commit.
97
98 ```console
99 $ git add .
100 $ git commit --amend
101 $ git push --force-with-lease $USER issue-<number>
102 ```
103
104 If you need to squash changes into an earlier commit, you can use:
105
106 ```console
107 $ git add .
108 $ git commit --fixup <commit>
109 $ git rebase -i --autosquash vmware/master
110 $ git push --force-with-lease $USER issue-<number>
111 ```
112
113 Be sure to add a comment to the PR indicating your new changes are ready to
114 review, as Github does not generate a notification when you git push.
115
116 ### Code Style
117
118 The coding style suggested by the Go community is used in `vmw-guestinfo`. See the
119 [style doc](https://github.com/golang/go/wiki/CodeReviewComments) for details.
120
121 Try to limit column width to 120 characters for both code and markdown documents
122 such as this one.
123
124 ### Format of the Commit Message
125
126 We follow the conventions described in [How to Write a Git Commit
127 Message](http://chris.beams.io/posts/git-commit/).
128
129 Be sure to include any related GitHub issue references in the commit message,
130 e.g. `Closes: #<number>`.
131
132 ## Reporting Bugs and Creating Issues
133
134 When opening a new issue, try to roughly follow the commit message format
135 conventions above.