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

后端 未结 3 2077
难免孤独
难免孤独 2021-01-30 16:10

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 \"

3条回答
  •  庸人自扰
    2021-01-30 16:49

    The accepted answer suggests to clone or add remote for the repository of the person who made the pull request. Another cleaner and simpler way is to use this command

    git pull https://github.com/otheruser/repo.git branchname
    

    For example, at the time of writing, ghi has three open pull requests that haven't been merged yet. This is what I did to merge them into my local repo.

    # I want to make sure my master is in sync with the upstream master
    git checkout -b merge-patches master
    # first pull request
    git pull --no-ff https://github.com/TiddoLangerak/ghi.git master
    # second pull request
    git pull --no-ff https://github.com/wayfare/ghi.git master
    

    Note that both pull requests were sent from master that is why I pulled from their master branch.

    This way, other repositories do not get added to your remotes, neither you have to cherry pick or clone them locally.

提交回复
热议问题