简体   繁体   中英

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.

  • Yes, I could contact the forker to instigate a pull request (a kind of pull-request request),
  • I could clone or even fork the fork, then spend time to apply the changes back into my repo

But I wonder if there is a better way?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM