Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup standardized git commit template #1181

Closed
kloudkl opened this issue Sep 29, 2014 · 4 comments
Closed

Setup standardized git commit template #1181

kloudkl opened this issue Sep 29, 2014 · 4 comments

Comments

@kloudkl
Copy link
Contributor

kloudkl commented Sep 29, 2014

Caffe has seen six hundred forks as of creating this issue. The contributors will no doubt continue to grow and diversify. For they and especially the reviewers to understand each others commits easily even with little knowledge of the initial issues, the commit messages should be much more comprehensive than one-liner commits with empty or almost empty message bodies.

It might be overkill to follow the heavy weight git commit messages guideline of OpenStack which serves to coordinate thousands of contributors from hundreds of organizations. Instead, setting up a relatively light weight commit template would be good balance between the two extreme cases. A simple example is here.

As a consequence of writing more self-contained commit messages, all of the commits of a PR had better be squashed into a single one to keep the one to one relation between commits and PRs and to reduce the writing burden. To automatically create release change logs from the git log, the issue/PR ID should always be set at the end of the commit messages.

@ducha-aiki
Copy link
Contributor

Vote up.

@longjon
Copy link
Contributor

longjon commented Sep 30, 2014

I agree that we should have a better standard (i.e., any standard) for commit messages.

I don't think we need a one-to-one correspondence between commits and PRs; I prefer that each commit be a small, logical, nonbreaking unit. This makes it easier to find bugs (e.g., using git bisect) and easier to understand the history. (As an example, I used nineteen commits in #594, and I think it would be quite hard to follow as a single one!) However, I do support keeping PR history clean by rewriting (e.g., PRs should never have commits to revert changes or fix typos, lint errors, or warnings within the PR; the commits should be rewritten to be right in the first place). The tradeoff is that this puts a higher bar on contributions, since contributors need to be comfortable with rewriting history.

If we are going to make a change to commit policy, I'd also lean in the direction of a soft change, so that we can see how we like it without creating an undue burden on anyone. A lightweight commit template might be a good idea, but I've not used one before, so I'd like to hear some more opinions...

@Yangqing
Copy link
Member

Yangqing commented Oct 1, 2014

A better PR message would definitely help. Personally I won't care too much on individual commit messages - I like commit messages to be fun and I don't mind having a few commits flying around, as long as they are correct in the end.

@shelhamer
Copy link
Member

A key part of PR quality is communication. High quality contributions come with thoughtful PR descriptions and commit messages and I'm afraid there's no template for consideration.

I like my commits atomic and echo @longjon's thoughts on the matter. I'm in total disagreement that PRs should be a single commit -- in fact, single commit PRs of any non-trivial change are the most difficult to review.

A PR is ideally one pure thought and the commits carry out the steps to realize it. #594 and other PRs by @longjon and @jeffdonahue are fine examples in this regard.

Closing since we have not come up with a commit template and it is not clear at least to me how it will help. Instead there should be a place in the contributing guide for the details of

I prefer that each commit be a small, logical, nonbreaking unit. This makes it easier to find bugs (e.g., using git bisect) and easier to understand the history. (As an example, I used nineteen commits in #594, and I think it would be quite hard to follow as a single one!) However, I do support keeping PR history clean by rewriting (e.g., PRs should never have commits to revert changes or fix typos, lint errors, or warnings within the PR; the commits should be rewritten to be right in the first place). The tradeoff is that this puts a higher bar on contributions, since contributors need to be comfortable with rewriting history.

although seeing it all at once might be intimidating. Suggestions to improve the developing and contributing guide are definitely welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants