Home > front end >  How to merge a branch of a fork to a branch of another fork in github?
How to merge a branch of a fork to a branch of another fork in github?

Time:07-24

I know how to compare between forks in Github. However I am running into a problem.

I am trying to merge the unblock_events_windows_move_resize branch of enter image description here So what is the problem here?

CodePudding user response:

I know if you are the one who created the original repo and then someone forked it, only they can create a pull request to upstream through the UI. But in terms of opening a PR from one fork to another fork via the web UI, I don't think it's possible (at least at the time of this post).

However, you can easily accomplish what you want via the git CLI tool, assuming both forks are public.

Option 1: git pull

git pull can accept a git URL as an argument. What this means, is you can effectively do git pull <GIT URL> <branch name> to merge any public fork into your own. So in this case you would do git pull https://github.com/mmozeiko/glfw.git unblock_events_windows_move_resize. This is good for one-time or occasional merges. A more permeant option would be to set up a second remote.

Option 2: Setting up a second remote

You can add numerous remotes to your local repository. By default, projects' cloned from GitHub will have a remote called origin which points to your repository (via the Git URL). You can add a new remote to any repository using git remote add <short form> <Git URL>. In your case, this might be something like git remote add mmozeiko https://github.com/mmozeiko/glfw.git. Now you can checkout your branch via git checkout and then do git pull mmozeiko unblock_events_windows_move_resize.

  • Related