4
4
5
5
First, fork the repository on GitHub to your personal account.
6
6
7
- Note that ` GOPATH ` can be any directory, the example below uses ` $HOME/govmomi ` .
8
- Change ` $USER ` below to your Github username if they are not the same.
9
-
10
- ``` console
11
- $ export GOPATH=$HOME /govmomi
12
- $ go get github.com/vmware/govmomi
13
-
14
- $ cd $GOPATH /src/github.com/vmware/govmomi
15
- $ git config push.default nothing # anything to avoid pushing to vmware/govmomi by default
16
- $ git remote rename origin vmware
17
- $
git remote add $USER [email protected] :$USER /govmomi.git
18
- $ git fetch $USER
7
+ Change ` $USER ` in the examples below to your Github username if they are not the
8
+ same.
9
+
10
+ ``` bash
11
+ git clone https://github.com/vmware/govmomi.git && cd govmomi
12
+
13
+ # prevent accidentally pushing to vmware/govmomi
14
+ git config push.default nothing
15
+ git remote rename origin vmware
16
+
17
+ # add your fork
18
+ git remote add
$USER [email protected] :
$USER /govmomi.git
19
+
20
+ git fetch -av
19
21
```
20
22
21
23
## Contribution Flow
@@ -38,40 +40,40 @@ and **supported prefixes**, e.g. `govc: <message>`.
38
40
39
41
### Example 1 - Fix a Bug in ` govmomi `
40
42
41
- ``` console
42
- $ git checkout -b issue-< number> vmware/master
43
- $ git add < files>
44
- $ git commit -m " fix: ..." -m " Closes: #<issue-number>"
45
- $ git push $USER issue-< number>
43
+ ``` bash
44
+ git checkout -b issue-< number> vmware/master
45
+ git add < files>
46
+ git commit -m " fix: ..." -m " Closes: #<issue-number>"
47
+ git push $USER issue-< number>
46
48
```
47
49
48
50
### Example 2 - Add a new (non-breaking) API to ` govmomi `
49
51
50
- ``` console
51
- $ git checkout -b issue-< number> vmware/master
52
- $ git add < files>
53
- $ git commit -m " Add API ..." -m " Closes: #<issue-number>"
54
- $ git push $USER issue-< number>
52
+ ``` bash
53
+ git checkout -b issue-< number> vmware/master
54
+ git add < files>
55
+ git commit -m " Add API ..." -m " Closes: #<issue-number>"
56
+ git push $USER issue-< number>
55
57
```
56
58
57
59
### Example 3 - Add a Feature to ` govc `
58
60
59
- ``` console
60
- $ git checkout -b issue-< number> vmware/master
61
- $ git add < files>
62
- $ git commit -m " govc: Add feature ..." -m " Closes: #<issue-number>"
63
- $ git push $USER issue-< number>
61
+ ``` bash
62
+ git checkout -b issue-< number> vmware/master
63
+ git add < files>
64
+ git commit -m " govc: Add feature ..." -m " Closes: #<issue-number>"
65
+ git push $USER issue-< number>
64
66
```
65
67
** Note** :
66
68
To register the new ` govc ` command package, add a blank ` _ ` import to ` govmomi/govc/main.go ` .
67
69
68
70
### Example 4 - Fix a Bug in ` vcsim `
69
71
70
- ``` console
71
- $ git checkout -b issue-< number> vmware/master
72
- $ git add < files>
73
- $ git commit -m " vcsim: Fix ..." -m " Closes: #<issue-number>"
74
- $ git push $USER issue-< number>
72
+ ``` bash
73
+ git checkout -b issue-< number> vmware/master
74
+ git add < files>
75
+ git commit -m " vcsim: Fix ..." -m " Closes: #<issue-number>"
76
+ git push $USER issue-< number>
75
77
```
76
78
77
79
### Example 5 - Document Breaking (API) Changes
@@ -84,10 +86,10 @@ The text after `BREAKING:` is used in the corresponding highlighted section.
84
86
Thus these details should be stated at the body of the commit message.
85
87
Multi-line strings are supported.
86
88
87
- ``` console
88
- $ git checkout -b issue-< number> vmware/master
89
- $ git add < files>
90
- $ cat << EOF | git commit -F -
89
+ ``` bash
90
+ git checkout -b issue-< number> vmware/master
91
+ git add < files>
92
+ cat << EOF | git commit -F -
91
93
Add ctx to funcXYZ
92
94
93
95
This commit introduces context.Context to function XYZ
@@ -96,19 +98,19 @@ Closes: #1234
96
98
BREAKING: Add ctx to funcXYZ()
97
99
EOF
98
100
99
- $ git push $USER issue-< number>
101
+ git push $USER issue-< number>
100
102
```
101
103
102
104
### Stay in sync with Upstream
103
105
104
106
When your branch gets out of sync with the vmware/master branch, use the
105
107
following to update (rebase):
106
108
107
- ``` console
108
- $ git checkout issue-< number>
109
- $ git fetch -a
110
- $ git rebase vmware/master
111
- $ git push --force-with-lease $USER issue-< number>
109
+ ``` bash
110
+ git checkout issue-< number>
111
+ git fetch -a
112
+ git rebase vmware/master
113
+ git push --force-with-lease $USER issue-< number>
112
114
```
113
115
114
116
### Updating Pull Requests
@@ -120,25 +122,25 @@ is to assist the reviewer(s) to easily detect and review the recent changes.
120
122
In case of small PRs, it's ok to squash and force-push (see further below)
121
123
directly instead.
122
124
123
- ``` console
125
+ ``` bash
124
126
# incorporate review feedback
125
- $ git add .
127
+ git add .
126
128
127
129
# create a fixup commit which will be merged into your (original) <commit>
128
- $ git commit --fixup < commit>
129
- $ git push $USER issue-< number>
130
+ git commit --fixup < commit>
131
+ git push $USER issue-< number>
130
132
```
131
133
132
134
Be sure to add a comment to the PR indicating your new changes are ready to
133
135
review, as Github does not generate a notification when you git push.
134
136
135
137
Once the review is complete, squash and push your final commit(s):
136
138
137
- ``` console
139
+ ``` bash
138
140
# squash all commits into one
139
141
# --autosquash will automatically detect and merge fixup commits
140
- $ git rebase -i --autosquash vmware/master
141
- $ git push --force-with-lease $USER issue-< number>
142
+ git rebase -i --autosquash vmware/master
143
+ git push --force-with-lease $USER issue-< number>
142
144
```
143
145
144
146
### Code Style
@@ -165,8 +167,8 @@ section in the `CHANGELOG`.
165
167
The following example creates a commit referencing the ` issue: 1234 ` and puts
166
168
the commit message in the ` govc ` ` CHANGELOG ` section:
167
169
168
- ``` console
169
- $ git commit -s -m " govc: Add CLI command X" -m " Closes: #1234"
170
+ ``` bash
171
+ git commit -s -m " govc: Add CLI command X" -m " Closes: #1234"
170
172
```
171
173
172
174
Currently the following prefixes are used:
0 commit comments