Home > Back-end >  How do I merge multiple pull requests together in a local branch
How do I merge multiple pull requests together in a local branch

Time:11-04

Imagine:

  • a github project
  • I have contributed there pull requests
  • there are other pull requests as well from other developers
  • Some of the pull requests are not yet integrated into the main branch

What I would like to do is now:

  • get the main branch
  • do an integration in there of multiple pull requests (my ones and from others) to get a "latest and greatest version". There is some functionality I would use now and not wait until the integration.
  • Basically I want to do a integration of multiple pull requests on a local branch without write access to the original repo on github.

There are several discussions about locally syncing pull requests, but always explaining this for one single one. one two

How can I integrate multiple pull requests on my local computer???

Update based on first answers and linked discussions: Here's what I did until now:

  • gqrx is the name of the project.
  • integration the name of the local repository
  • 1142 and 1147 are the numbers of my pull requests
> git clone https://github.com/gqrx-sdr/gqrx.git

> cd gqrx

> git switch -c integration master
Switched to a new branch 'integration'

> git fetch origin refs/pull/1142/head:refs/heads/1142
remote: Enumerating objects: 26, done.
remote: Counting objects: 100% (20/20), done.
remote: Total 26 (delta 20), reused 20 (delta 20), pack-reused 6
Unpacking objects: 100% (26/26), 3.67 KiB | 47.00 KiB/s, done.
From https://github.com/gqrx-sdr/gqrx
 * [new ref]         refs/pull/1142/head -> 1142

> git merge origin/1142
merge: origin/1142 - not something we can merge

> git merge origin/pull/1142
merge: origin/pull/1142 - not something we can merge

I always end up un nothing to merge, or I just have one single of the pull requests.

CodePudding user response:

Bringing all the comments above brought me to the follwing commands.

Again:

  • gqrx is the name of the project.
  • integration the name of the local repository
  • 1142 and 1147 are the numbers of my pull requests I want to combine in one build
> git clone https://github.com/gqrx-sdr/gqrx.git
> cd gqrx

> git switch -c integration master

> git fetch origin pull/1142/head:refs/heads/pr1142
> git merge pr1142

> git fetch origin pull/1147/head:refs/heads/pr1147
> git merge pr1147

Many thanks to everybody for your support!

  • Related