Merge GitHub Pull Requests


To merge a pull request.


Let’s take Staticman PR 231 as an example. I would like to test it before commiting this merget to Heroku.

$ cd ~/staticman
$ git branch -a
* deploy
$ git remote -v
eduardoboucas (fetch)
eduardoboucas (push)
heroku (fetch)
heroku (push)
$ git pull eduardoboucas pull/231/head:deploy
remote: Enumerating objects: 10, done.
remote: Counting objects: 100% (10/10), done.
remote: Total 18 (delta 10), reused 10 (delta 10), pack-reused 8
Unpacking objects: 100% (18/18), done.
 ! [rejected]        refs/pull/231/head -> deploy  (non-fast-forward)

I executed the last command on branch dev. I didn’t have time to figure out the reason for this error. The following commands should work.

$ git fetch eduardoboucas pull/231/head
 * branch            refs/pull/231/head -> FETCH_HEAD

$ git merge FETCH_HEAD
Merge made by the 'recursive' strategy.
 controllers/auth.js                |   6 ++---
 coverage/cobertura-coverage.xml    |  32 +++++++++++------------
 test/unit/controllers/auth.test.js | 127 ++++++++++++++++++++++++++++++-----------------------------------------------------------
 3 files changed, 61 insertions(+), 104 deletions(-)

A merge commit has two parents. The second is the one merged from another branch, and it’s referred as HEAD^2.

To see the overall change of the merged branch, a more useful command is git diff HEAD^..HEAD --stat.

After some local testing (which I didn’t perform), I pushed this merge commit so as to update the my testing Staticman v3 API.

No comment

Your email address will not be published. Required fields are marked *.