Fuhrmanator
Fuhrmanator

Reputation: 12922

Merge downstream commits in GitHub (not waiting for a pull request)

One of my GitHub repos was forked, and the (downstream) developer made changes I'd like to merge immediately (it's one commit off my repo's current state). Said dev did not yet do a pull request. I was thinking there might be a way I could create a PR from the commit in his downstream fork.

But I wonder if there is a better way?

Upvotes: 1

Views: 388

Answers (1)

torek
torek

Reputation: 489748

Assuming you have, on your own computer (I'll call this "your laptop"), a clone of your GitHub repository, simply add their fork of your GitHub repo to your laptop Git:

git remote add xyzzy https://github.com/their/fork.git

where xyzzy is a terrible name for this downstream. (Pick some better name, such as downstream or fred, and replace xyzzy in the subsequent commands.)

Now you can run:

git fetch xyzzy

You now have, in your laptop Git, xyzzy/* remote-tracking names corresponding to their—the downstream fork's—branch names. You can merge any commits you like, and then git push origin as usual.

Upvotes: 2

Related Questions