-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Reasons for not using GitHub's green button are unconvincing #11674
Comments
Perhaps it's referring to multiple authors of multiple commits in the PR? That would be pretty common... |
That paragraph refers to "Squash and merge". You can't have multiple commits after squashing. |
But if you squash multiple commits from multiple authors, attribution is lost (except for the author of the last commit), which I think is what the sentence is getting at? |
That's an argument against squashing, but not an argument against using the GitHub feature when you want to squash. |
Last discussed in #8893 (comment), cc/ @MylesBorins @evanlucas @Fishrock123 .
I think it was Myles who said that metadata was added, @MylesBorins can you provide an example? Does
@evanlucas could you provide an example of
I think the warning about the issue with squashing is valid (yes it's an argument against squashing of any kind, but still a valid thing for Collaborators to consider IMO). If we were going to allow squashing for PRs where it makes sense, then I think the most important advice would be to remember to add metadata and ensure CI has run (and delete the PR number from the title). I personally prefer using the Terminal to land commits, I'm not sure I'd check things as thoroughly if it was just a matter of clicking a button (e.g. running |
Yeah but they don't create merge commits.
No, it doesn't let you modify the commits in any way. If by metadata you mean "Reviewed-By:" etc, then you'd have to make sure it's added beforehand. That does make the feature less useful, but not "bad".
Possibly, but it doesn't belong under the "green button" section anyway. It's not specific to the button. |
A lot of PRs can be safely merged using the "squash and merge" button imo by only making sure that:
This greatly simplifies the process of landing a PR which is, for good reasons, quite cumbersome. |
That implies that if there's purple merged status with a single commit, the "Landed in..." comment is unnecessary. |
Yes, that's true. I'm sure it was discussed somewhere, but I can't find it.
If you're going through and adding metadata (from the command line), isn't it easier just to rebase and
I don't think our docs say that it's "bad", just that it's not useful (and thus should be avoided). I think the |
Oh, so that's what that sentence actually means. That makes more sense.
I agree, but maybe someone prefers using the button for the actual merging for whatever reason. Does
Well it says above "Please never use GitHub's green "Merge Pull Request" button." and tells you to revert it if you accidentally do. That kinda implies that it's bad.
Agreed. The current documentation is inconsistent with the project settings. |
Yes it does. If you:
then GitHub works out that the commit hash of the head of your PR branch and master are the same, and adds the EDIT: Just realised that this is covered in COLLABORATOR_GUIDE.md#L452-L463. |
The `Create a Merge Commit` and `Rebase and Merge` buttons are not currently suitable for merging Pull Requests, and are thus disabled. Squashing is okay, so we should document its use. Fixes: nodejs#11674
PR raised: #11686 |
Fwiw, the |
@addaleax I've run |
I guess that |
@nodejs/ctc ... general thoughts on this? Using the squash and merge seems to be ok at this point.... or, at the very least, I have yet to see any serious issues associated with it's use. |
I have no problem with it if there is no observable difference. People using the button would need to make sure they show up as the committer though. |
Does green button validate line lengths in commit message? |
That means we can't use "Squash and merge" for merging our own PRs. That's unfortunate.
Nope. |
How would a committer validate line lengths then? I guess we can write a Chrome Extension, but overall it may not end up being a comfortable workflow. |
Using a separate text editor I guess. A Chrome extension would be cool. |
Aside: I lean heavily on @evanlucas's |
@indutny how is this different from the current workflow? You still have to validate line lengths in vim or your editor. |
@lpinca yes, but I don't have to leave to the console at the moment. Furthermore since I check it in vim and use the contents of vim buffer as a commit message, I don't have to copy and paste it anywhere. |
@indutny I agree, it might be more error prone but I think it's not a valid reason to not use the "Squash and merge" button. I usually copy/paste anyway, especially when adding metadata. |
I'd count "more mistakes" as an observable difference, though. |
@bnoordhuis that's my point too. |
Should this remain open? |
@Trott I don't think so. |
Closing due to inactivity. Feel free to re-open or comment if you think this should be open and the conversation should continue. |
It still lists the same unconvincing reasons, so reopening. |
That's where @Trott's suggestion to always use core-validate-commit comes in handy.
I fear this might be true. Our current workflow more or less ensures that people pay a lot of attention to what they are doing, and I am not sure that will be true when using GitHub's button. Don't forget this section of the guide, at least when it comes to code changes:
Sure, we could as well run the tests using CI before merging the changes, but that won't detect problems caused by rebasing and - as CI can take quite some time - it will also miss anything caused by other changes to the respective branch (even though local testing takes time as well). We could as well run CI after pushing to master, but at that point the damage is already done. |
This isn't a problem in practice. CI already rebases onto the target branch and chances for new commits to be added to target branch before merging are low. Patches are usually not landed at such high rate (every 20 min or so). |
Summary: While using the green button isn't "bad", it can only be used with a subset of PRs and introduces a greater margin of error while also adding unnecessary noise to the commit graph (if using the "merge" option). So maintaining that using the green button is off limits is reasonable and isn't necessary to discuss further. @seishun
Here's the commit information from the PR:
And from the "merge commit": $ git log -1 --show-signature --pretty=fuller 5984393
commit 5984393d5056ed84bae62c4acf41a9c03df6f4f1
Merge: 8dae1d2 e55a88a
Author: Trevor Norris <trev.norris@gmail.com>
AuthorDate: Thu Jul 27 05:58:49 2017 -0600
Commit: GitHub <noreply@github.com>
CommitDate: Thu Jul 27 05:58:49 2017 -0600
Merge pull request #3 from trevnorris/test-pr
test patch
PR-URL: https://github.com/trevnorris/threx/pull/3 Issues from using this:
I realize you addressed (1) in the following comment:
It might not be "bad", but it is more error prone. Adding more possibility for error isn't a step in the right direction. As explained in (2) using the button only adds noise to the commit log. As a follow up I landed two PRs side-by-side using merge and this is the resulting graph:
All of these commits could have been fast-forwarded, but instead we now have this interwoven mess to look at when reviewing our git history. Why should we say that's alright? As for (3), I hope we'd work towards more developers signing their commits. So why add an option to a pipeline that would make a goal impossible? The other two options require a rebase, and I've verified that both of these remove all signatures in the PR. You might say "just check if any of the commits in the PR are signed" but I ask again, why allow an option that is more error prone, and makes a goal of increasing the number of signed commits more difficult? NOTE: There is no stated goal that more commits should be signed, but with our increasing security measures (e.g. enforcing 2FA) I think it's a safe assumption that increasing the number of signed commits is a desirable goal.
Problem is we can't enforce it, and @Trott even follows up with:
So there's no way to enforce commit message format, and because github does things like shorten URLs in the commit messages it's necessary to look at the |
@trevnorris the "merge commit" option has been discarded and marked as not viable from the beginning. The discussion was on the "squash and merge" option. P.S. I noticed that we now have only the "merge commit" option enabled. I'm pretty sure we disabled it and kept only the "squash and merge" option to reduce the risk of creating merge commits. Not sure when that changed. |
@lpinca, that's not quite right, we kept the Discussion: #11686 (comment) |
For anyone reading this, this is (AIUI) a documentation request, not a "we should revisit this discussion" request. |
@gibfahn thank you. I guess I stopped reading that thread when it was closed. |
Closing as it seems somewhat resolved (there are reasons not to use them and we now have better tools to land PRs). |
The Landing Pull Requests section in COLLABORATOR_GUIDE.md admonishes against using the button for merging, but the cited reasons are arguable:
Obsolete advice. This feature is disabled in this repo, so it's impossible to create a merge commit using the button in the first place.
See above. If anything, this should explain why it's disabled, rather than why one shouldn't use it.
Does "commit title" mean the first line of the commit message? If so, it's not clear how one can add metadata to the first line of text. Anyway, the commit messages for all commits in the PR are left unmodified.
Doesn't.
Same question as above. It does add the PR number to the first line of the commit message, but you can remove it before confirming.
Not relevant for most PRs. Besides, how would you have multiple authors for a single commit anyway?
My proposal: replace this whole section with a warning about the automatically added PR number.
The text was updated successfully, but these errors were encountered: