Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I merge a pull request on someone else's project in git?

I cloned this repo on my computer: https://github.com/derobins/wmd.git

There are several bugs with it though, and it looks like another user has fixed them and issued "Pull requests" (I assume these are requests for their changes to be committed?)

Is it possible to merge those changes into my local version?

EDIT: just to be clear, this is not my repository. I am using the WMD editor from derobins, but it has several bugs which those pull requests purport to fix. I have cloned the repo on Ubuntu (not in github) and was hoping to merge those changes in if possible.

like image 545
DisgruntledGoat Avatar asked Apr 05 '11 14:04

DisgruntledGoat


1 Answers

(GitHub has very thorough documentation on how to deal with pull requests.)

Essentially, you'll want to add a remote for the repository of the person who made the pull requests, e.g.:

git remote add helpful git://github.com/helpful-person/whatever.git 

... then fetch their changes into remote-tracking branches:

git fetch helpful 

... so that now you have all the commits from that person's GitHub repository in your clone of the upstream repository. If you look at the additional commits within that pull request you could:

  1. merge the latest one, e.g. git merge 75708aeab5
  2. cherry pick each of those changes, e.g. git cherry-pick 2142db89, git cherry-pick 75708aeab5
  3. create a local branch to work on them further, e.g. git checkout -b fix-for-issue3 75708aeab5
  4. etc. etc.

An alternative is to just clone the repository of the contributor who made the pull requests instead, if that's the same but for those fixes.

like image 60
Mark Longair Avatar answered Sep 28 '22 02:09

Mark Longair