asciidoctor / asciidoctor-community-docs

Process, policy, and other shared documentation for the Asciidoctor community of projects.
Other
4 stars 30 forks source link

Define pull request conventions #9

Open mojavelinux opened 3 years ago

mojavelinux commented 3 years ago

Within the Asciidoctor community of projects, I think we should agree on a general set of conventions / guidelines for PRs (at the very least, for the core projects and those closely associated with it). This will make it easier to work in the various projects without having to remember what all the individual rules are. I have been adhering certain conventions over the years, but even those may need to be revisited and revised. What I'm about to propose are meant to be general guidelines, not strict rules. But the closer we stick to the guidelines, the easier it is to get into the flow.

Of course, we can't mandate behavior. That's not the point. The point is for us maintainers to lead by example and develop a workflow that's consistent and works well across the projects. What other recommendations would you add that have proven to work well?

slonopotamus commented 3 years ago

Thus far, I've been using resolves #<issue number> summary goes here (PR #<pr number>).

Please, please, omit that PR. I am just too lazy and forget every time to type PR. GitHub itself autosuggests just (#number), without PR part.

This makes it easier to organize branches locally

I don't think conventions should care how user organises their local branches? Also, most likely external contributors won't follow branch naming conventions. Will you reject their PRs just because they named the branch unconventionally? Note that it isn't possible to change branch name without recreating PR.

All the rest: I'm +1 about resolves <issue number> subject line, changelog entries, issue requirement and merge strategy that you use (rebase'n'squash).

mojavelinux commented 3 years ago

Thanks for that feedback, Marat!

Will you reject their PRs just because they named the branch unconventionally?

As I stated, these are "meant to be general guidelines, not strict rules" and "we can't mandate behavior". This is about leading by example. So no, I would not consider the name of the branch to be grounds for rejecting a PR as long as it's a dedicated branch. However, if it's the main branch, that's when I would consider enforcing the rule and having the contributor resubmit.

Please, please, omit that PR #

I'm definitely willing to reconsider my practice here. However, I must profess that it's convenient to be able to jump directly from the history to the pull request, which GitHub otherwise doesn't provide.

I suppose we could restate this to say that we should ensure the issue is linked to the PR in the GitHub interface. That way, it's just one more click away.

slonopotamus commented 3 years ago

However, I must profess that it's convenient to be able to jump directly from the history to the pull request, which GitHub otherwise doesn't provide.

I mean, GitHub provides a way to jump to PR, see https://github.com/asciidoctor/asciidoctor-epub3/commit/38dd0122c70564a67c5dbcdbfe93a90dc7295b66 for example. So, commit message has both link to issue and link to PR. It just doesn't have PR text that you insert by hand)

slonopotamus commented 3 years ago

And yep, I am literally talking about these three symbols: P, R and whitespace.

mojavelinux commented 3 years ago

commit message has both link to issue and link to PR. It just doesn't have PR text that you insert by hand

Aha! I see what you're saying. That would be fine by me.

slonopotamus commented 3 years ago

:+1:

So, WRT branch naming - I'm negative-neutral about adding such rule. When you see someone else's branch, you see it as a PR. So it is too late to rename it. When you create your own branch - name it whatever you like. We use rebase'n'squash strategy, so merged branch name doesn't appear in git history of target repository. So, what does branch name affect? The text that you see in PRs (gambhiro wants to merge 6 commits into asciidoctor:master from gambhiro:stylus)? It's that user namespace, they have full rights to name their own branches whatever they like. And I don't see other places where branch names would matter.

mojavelinux commented 3 years ago

It helps considerably when I add the person's remote to my own repository and I'm navigating between branches. Without the issue number in the branch name, it quickly becomes confusing which branch is which. And the issue number alone gives no context outside of the issue tracker. So having both is idea.

I'm speaking here from several years of experience now using this practice. And it has proven itself to be very effective in my own workflow. Because it has made such a difference, I am now advocating for it as a best practice / guideline.

abelsromero commented 3 years ago

Does 'merge strategy' include the merge type? aka-. Merge commit, squash & merge, rebase

On Wed, Mar 31, 2021 at 10:18 PM Dan Allen @.***> wrote:

It helps considerably when I add the person's remote to my own repository and I'm navigating between branches. Without the issue number in the branch name, it quickly becomes confusing which branch is which. And the issue number alone gives no context outside of the issue tracker. So having both is idea.

I'm speaking here from several years of experience now using this practice. And it has proven itself to be very effective in my own workflow. Because it has made such a difference, I am now advocating for it as a best practice / guideline.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/asciidoctor/asciidoctor-community-docs/issues/9#issuecomment-811434249, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMDNIMZZWI5WIKSNM3RCJTTGN7STANCNFSM42DFOLSQ .

mojavelinux commented 3 years ago

Does 'merge strategy' include the merge type? aka-. Merge commit, squash & merge, rebase

Yes, that's what I'm referring to. And I don't think I would suggest which one a project should use. But whatever one the project does use, I think how it's annotated should be consistent across projects.

I tend to use the squash and merge unless the PR has multiple discrete stages, in which case I might use the merge commit. But to be honest, I'm never quite sure what the right decision is.

abelsromero commented 3 years ago

Good to know Personally I've been switching between squash and merge-commit, but for sake of simplicity I lately lean heavily toward squash. The 1 to 1 relationship between commit & PR helps my sanity.

regards,

On Wed, Mar 31, 2021 at 11:08 PM Dan Allen @.***> wrote:

Does 'merge strategy' include the merge type? aka-. Merge commit, squash & merge, rebase

Yes, that's what I'm referring to. And I don't think I would suggest which one a project should use. But whatever one the project does use, I think how it's annotated should be consistent across projects.

I tend to use the squash and merge unless the PR has multiple discrete stages, in which case I might use the merge commit. But to be honest, I'm never quite sure what the right decision is.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/asciidoctor/asciidoctor-community-docs/issues/9#issuecomment-811466241, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMDNIO33DX3IDTOKDWE6QLTGOFLNANCNFSM42DFOLSQ .

ggrossetie commented 3 years ago

subject line - Third, we should agree on the format for the subject line for a PR. Should it start with an action keyword, like fixes|resolves|closes ? If we use these prefixes, when it's merged, the issue automatically gets closed. I know that GitHub refuses to recognize the issue number in the subject. But if it's not in the subject, then you can't quickly scan for issue-closing commits in the git history after merging it. So perhaps we need it in both the subject and the description.

For reference, I'm occasionally using ref #<issue number> title in the subject line when a pull request is related to an issue but does not fully resolve it. Usually, it happens when I'm working on a new feature that requires multiple iterations. Sometimes it's easier (for everyone really!) to create small pull requests that are easier to review and merge them progressively rather than reviewing a large pull request again and again.