News for hackers. Stuff that matters.
Re:Merge Pull Request Considered Harmful by MaikuMori on Thursday June 26, 2014 @07:45AM (#7949107)
Is this exactly situation that https://help.github.com/articles/checking-out-pull-requests-... documents?

So basically:

    git fetch origin pull/ID/head:BRANCHNAME
    git checkout BRANCHNAME
And now you can edit that pull request and/or make new pull request based on the previous one. Or just simply merge in master.
Re:Merge Pull Request Considered Harmful by jakub_g on Thursday June 26, 2014 @08:16AM (#7949193)
It's possible to configure it to have all PRs automatically fetched when you use `git fetch origin`:

https://gist.github.com/piscisaureus/3342247

and then you'll have each PR available under sth like

  git checkout pr/123
Re:Merge Pull Request Considered Harmful by ntalbott on Thursday June 26, 2014 @09:39AM (#7949530)
Cool, I'll have to try that! Does it also pull PR's that live on feature branches in forks of the root repo?
Re:Merge Pull Request Considered Harmful by jakub_g on Thursday June 26, 2014 @10:23AM (#7949752)
It fetches all the PRs. Once you open a PR for a project (even from a fork), github creates a local branch for that PR in the upstream project.

Note though that doing a fetch will take some time the first time after you set up this - it will fetch all the historical PRs.

Re:Merge Pull Request Considered Harmful by watson on Thursday June 26, 2014 @07:54AM (#7949130)
This also eliminates the use of the "Merge pull request" button which removes all the pull-request-merged-commits.

I don't know about you guys, but I have not found them useful? Do you use the merge commits for anything?

Re:Merge Pull Request Considered Harmful by johnkeeping on Thursday June 26, 2014 @08:30AM (#7949241)
I always use "--no-ff" when merging topic branches to master. The advantage is that you can keep individual commits on the topic branch readable and still get an overview of the changes between two releases with "git log --first-parent".

You can also see the set of changes in a topic merge easily with "git log ${merge}^2..${merge}^1" whereas if you use a fast-forward merge it's not at all obvious which sets of commits are related.

Re:Merge Pull Request Considered Harmful by aaronharnly on Thursday June 26, 2014 @08:37AM (#7949264)
We use the merge commits to trace back a given deploy or machine image to the pull request that caused it. So from a given deployed AMI, a Jenkins job can point to the pull request, and hence the full context of the feature or bug description, the back-and-forth of code review, etc.
Re:Merge Pull Request Considered Harmful by andrewchilds on Thursday June 26, 2014 @08:39AM (#7949269)
The problem is that pull requests are one-way, read-only collaborations. If I want to make changes, I have to close the contributor's PR and open my own. With write access, I could do:

    git fetch origin pull/ID/head:BRANCHNAME
    git checkout BRANCHNAME
    // make changes
    git push origin pull/ID/head
Re:Merge Pull Request Considered Harmful by eLobato on Thursday June 26, 2014 @10:28AM (#7949784)
You can always send a PR to the original sender PR branch.
Re:Merge Pull Request Considered Harmful by ntalbott on Thursday June 26, 2014 @08:22AM (#7949210)
OP author here...

The result is the same, but I've found the `git am` workflow to be much smoother vs. mucking around with remotes. Some of that could be due to the nature of the OSS project I work on - ActiveMerchant - since just in the last month we've had 30+ unique contributors, and most of them have contributed a single change.

My general recommendation is to make sure you try out the `git am` flow for a bit, but then just do what works best for you.

Re:Merge Pull Request Considered Harmful by peff on Thursday June 26, 2014 @08:29AM (#7949236)
Keep in mind that `git am` is not identical to pulling the commits. You might be applying the commits on a different base, and certainly your committer field will be different (not to mention any substantive changes you make). As a result, the sha1 of the commits you create will be different than those of the original submitter.

This makes life harder for the submitter, because they cannot ask a simple question: were my commits merged into the upstream repository? Because no, they weren't; but commits that are the moral equivalent were. Usually `git log --cherry-pick` can correlate the two, but not always.

We do use `git am` upstream when working on git itself, for the reasons you indicate in the article (plus we like mailing-list based review). But it does come at a cost in managing the various versions of patches.

Re:Merge Pull Request Considered Harmful by tytso on Thursday June 26, 2014 @08:44AM (#7949293)
This is why it is a good idea for proposed patches to be sent to a mailing list, where other people other than the repo owner can more easily review patches, and then to have those patches tracked via patchwork.

And when I accept a patch, even if I've had to edit the commit summary so it is parsable english (not all of my contributors speak english as a first language), I send a reply via e-mail saying "Thanks, applied".

Re:Merge Pull Request Considered Harmful by ntalbott on Thursday June 26, 2014 @09:28AM (#7949487)
Agreed, editing contributions does add a bit of extra work for contributors post-inclusion, especially if they've been using their own branch in production. That said, since this is a PR flow, the contributor will get an email from Github that their PR has been closed, and they can track directly from that PR to the closing commit.

While I've often wished that Github had a proper mailing list per repository that could be used to discuss changes, I have to say that one awesome thing about PR's is how nice they make reviewing a patch. The diff view is just awesome, so now that I have a `git am` style flow with them it would be hard for me to switch to just passing patches around on a mailing list. That said, a mailing list would still be a welcome adjunct to the PR flow if done right.

Re:Merge Pull Request Considered Harmful by peterwwillis on Thursday June 26, 2014 @09:42AM (#7949550)
Well the commits may be changed during pulling if the maintainer deems it necessary (or a merge just ain't happening cleanly) so it seems like the solution would be to just include the SHAs that were merged in the 'git am' commits. Then the submitter knows what they intended to get pulled got in, which should resolve patch verification, right?
Re:Merge Pull Request Considered Harmful by lotyrin on Thursday June 26, 2014 @08:36AM (#7949261)
I think maybe you overlooked the grandparent's suggestion; you don't have to mess with adding contributors' remotes. Open pull request heads are available on your existing remote.