Now that you know the target branch, create a new branch with the correct name and the pull request number. -{snip: Example: create a branch targeting master (V8_9 in this example) for github pull request ID 107} +{snip: Example 1: create a branch targeting *master* (V8_9 in this example) for github pull request ID 107} git fetch github pull/107/head:V8_9-pr107 {endsnip} -Now check out the target branch and merge the branch containing the pull request. +{snip: Example 2: create a branch targeting *stable* (V8_8 in this example) for github pull request ID 107} +git fetch github pull/107/head:V8_8-pr107 +{endsnip} + + +Now check out the target branch and merge the branch containing the pull request. There are two cases below. + +*MOST LIKELY*, the pull request was made from master. So you probably want to just do this: {snip: Example: check out the master and merge the V8_9-pr107 branch created above} git checkout master git pull git merge V8_9-pr107 -git push +git push master {endsnip} -*THIS IS RARE*, but if the pull request was targeted for stable (or a release branch) do the normal merges forward (consult with TimT and TJ if dealing with a release branch). -{snip: Example: Merge the stable branch forward into master} -git checkout master +Then, if the pull request was made from master but should also apply to the stable branch (because it's a bug fix), then cherry-pick the commit back to the correct branch. *There may be more than one commit in a pull request.* If this is the case, make sure you do them in the correct order. If you are picking into a release branch consult with TimT and TJ first. +{snip: Example: Cherry-pick the commit(s) back to stable (V8_8-branch in this example)} +git checkout V8_8-branch git pull -git merge V8_8-branch -git push +git cherry-pick <commit-hash-1> +git cherry-pick <commit-hash-2> +... +git push V8_8-branch {endsnip} -*MORE LIKELY*, if the pull request was made from master but should also apply to stable (because it's a bug fix), then cherry-pick the commit back to the correct branch. -{snip: Example: Cherry-pick the commit back to stable (V8_8-branch in this example)} + +*THIS IS EXTREMELY RARE*, but if the pull request was targeted for stable (or a release branch), merge the pull request branch to the target branch and then do the normal merges forward. Consult with TimT and TJ if dealing with a release branch. +{snip: Example: Merge the pull request into a stable branch (V8_8-branch in this example) and then forward into master} git checkout V8_8-branch -git cherry-pick <commit-hash> -git push +git pull +git merge V8_8-pr107 +git push V8_8-branch +git checkout master +git pull +git merge V8_8-branch +git push master {endsnip} {linebreak}