Browse code

CONTRIBUTING: add tips for succesful changes

Expand the contributing doc to include tips for successful PRs and
guidance on commit messages. This should help contributers to have
better position PRs that are more likely to be merged.

Signed-off-by: Stephen J Day <stephen.day@docker.com>

Stephen J Day authored on 2017/01/11 08:59:09
Showing 1 changed files
... ...
@@ -173,10 +173,64 @@ committing your changes. Most editors have plug-ins that do this automatically.
173 173
 Pull request descriptions should be as clear as possible and include a reference
174 174
 to all the issues that they address.
175 175
 
176
+### Successful Changes
177
+
178
+Before contributing large or high impact changes, make the effort to coordinate
179
+with the maintainers of the project before submitting a pull request. This
180
+prevents you from doing extra work that may or may not be merged.
181
+
182
+Large PRs that are just submitted without any prior communication are unlikely
183
+to be successful.
184
+
185
+While pull requests are the methodology for submitting changes to code, changes
186
+are much more likely to be accepted if they are accompanied by additional
187
+engineering work. While we don't define this explicitly, most of these goals
188
+are accomplished through communication of the design goals and subsequent
189
+solutions. Often times, it helps to first state the problem before presenting
190
+solutions.
191
+
192
+Typically, the best methods of accomplishing this are to submit an issue,
193
+stating the problem. This issue can include a problem statement and a
194
+checklist with requirements. If solutions are proposed, alternatives should be
195
+listed and eliminated. Even if the criteria for elimination of a solution is
196
+frivolous, say so.
197
+
198
+Larger changes typically work best with design documents. These are focused on
199
+providing context to the design at the time the feature was conceived and can
200
+inform future documentation contributions.
201
+
202
+### Commit Messages
203
+
176 204
 Commit messages must start with a capitalized and short summary (max. 50 chars)
177 205
 written in the imperative, followed by an optional, more detailed explanatory
178 206
 text which is separated from the summary by an empty line.
179 207
 
208
+Commit messages should follow best practices, including explaining the context
209
+of the problem and how it was solved, including in caveats or follow up changes
210
+required. They should tell the story of the change and provide readers
211
+understanding of what led to it.
212
+
213
+If you're lost about what this even means, please see [How to Write a Git
214
+Commit Message](http://chris.beams.io/posts/git-commit/) for a start.
215
+
216
+In practice, the best approach to maintaining a nice commit message is to
217
+leverage a `git add -p` and `git commit --amend` to formulate a solid
218
+changeset. This allows one to piece together a change, as information becomes
219
+available.
220
+
221
+If you squash a series of commits, don't just submit that. Re-write the commit
222
+message, as if the series of commits was a single stroke of brilliance.
223
+
224
+That said, there is no requirement to have a single commit for a PR, as long as
225
+each commit tells the story. For example, if there is a feature that requires a
226
+package, it might make sense to have the package in a separate commit then have
227
+a subsequent commit that uses it.
228
+
229
+Remember, you're telling part of the story with the commit message. Don't make
230
+your chapter weird.
231
+
232
+### Review
233
+
180 234
 Code review comments may be added to your pull request. Discuss, then make the
181 235
 suggested modifications and push additional commits to your feature branch. Post
182 236
 a comment after pushing. New commits show up in the pull request automatically,