0

In GitHub, I have two forks with multiple branches each. I want to select two branches from each forked repo and put one on top of other.

For example:

  1. https://github.com/user1/reponame/tree/user1branch
  2. https://github.com/user2/reponame/tree/user2branch

I am trying to put user1branch of user1's forked repo on top of user2branch branch of the user2's forked repo.

I am not seeing much information about this. How can this be done?

K S
  • 301
  • 1
  • 4
  • 16

1 Answers1

0

There isn't a super straight-forward way to do this, since both forks inherit from the master repo, and not each other. Here's my best attempt anyway.

First, you want your project to look more like this: master has the absolute copy. Each user has their own fork of master for private work. When a user wants to contribute to master after locally testing the changes, he would create a pull request to push to master. Then, after the PR is merged, all other users would pull from the master repo.

At user1branch repo's home page, you can see how many commits your branch is ahead or behind the master repo. Create a new branch on master repo. Make a PR for that new branch from user1branch. After you merge it on master, user2branch would have to pull from the master repo to their own branch.

I hope this is helpful to you.

  • The problem is that I need to do this all locally. I don't have the option to ask the other users to sync with `master`. – K S Jun 02 '23 at 18:46
  • This might be relevant to your situation: [https://stackoverflow.com/questions/849308/how-can-i-pull-push-from-multiple-remote-locations](https://stackoverflow.com/questions/849308/how-can-i-pull-push-from-multiple-remote-locations) – aidan-j-rhoden Jun 03 '23 at 03:39