ama icon indicating copy to clipboard operation
ama copied to clipboard

How exactly do you merge PRs?

Open nexdrew opened this issue 10 years ago • 6 comments

I know you rarely use the "Merge pull request" button in GitHub, and I see you use Tower.

  1. What do you do to keep your commit history so clean?
  2. Is this roughly correct?
    1. Fetch the PR branch locally:

      git fetch origin pull/ID/head:pr/ID

    2. If PR contains N commits, squash them into one:

      git checkout pr/ID git rebase -i HEAD~N

    3. Cherry pick the squashed PR commit into master:

      git checkout master git cherry-pick -e pr/ID

    4. Prepend "Close #ID PR: " to the commit message and complete the cherry pick

    5. Run tests and push master

  3. Do you use a tool (e.g. Tower, apply-pr, or one of your own modules) to make this process easy?

learn-ways-of-the-force

nexdrew avatar Oct 08 '15 19:10 nexdrew

:+1: Been wondering this as well

booee avatar Oct 30 '15 19:10 booee

@nexdrew

Maybe the jQuery Repository Maintainers Guide can help you :)

Arkni avatar Nov 04 '15 14:11 Arkni

@Arkni Cool, thanks for the reference!

Found similar "rebase and merge --ff-only" strategy here via this SO answer, which can either preserve original commits or squash them before merging. Also aware of using hub and git am -3 as described here, but I haven't actually tried that.

I really just want to know how @sindresorhus does it. Still waiting patiently to find out. :wink:

nexdrew avatar Nov 04 '15 19:11 nexdrew

@nexdrew May be he is waiting for your PR to describe it more efficiently. :smiley:

igauravsehrawat avatar Jan 18 '16 05:01 igauravsehrawat

I quite sure @sindresorhus uses https://github.com/github/hub to merge PRs etc.

kevva avatar Jan 18 '16 08:01 kevva

https://github.com/blog/2141-squash-your-commits

@sindresorhus Does this mean you might be tempted to use the green button now? :smiley:

nexdrew avatar Apr 01 '16 20:04 nexdrew