Reputation: 47
I have a repo under Org1/Repo1 which I forked under Org2/Repo1. For some reason we did not keep the Repo1 under Org2 up to date with Repo1 under Org1. Now when I was trying to update the master branch under Org2/Repo1 I have message like this "This branch is 120 commits ahead, 1025 commits behind Org1/Repo1/master branch. "
Instead of bringing in changes related to all the 1025 commits I thought it would be easy to add back changes related to 120 commits on the current working repo Org2/Repo1. In this process I was trying to fork the Org1/repo1 under Org2 so that I can update my repo1 under org2, but it does not allow me to do so. In this case what is the best way to update my master branch under Org2/Repo1.
Thanks in advance!
Upvotes: 0
Views: 33
Reputation: 38639
I'm not sure this is really the right way to tackle your issue, but if you want to do it like that you probably need to cut the older forks parent-fork relationship to be able to create another fork under the same organisation.
But it should be easy and probably preferable to do whatever you want to do in the existing fork.
Upvotes: 0
Reputation: 26
This is probably due to a rebase on the org1/repo1 master branch.
You should rebase your org2/repo1 master branch.
Open a terminal, and go to the org2/repo1 clone folder.
Then add the org1/repo1 as a remote :
git remote add org1 https://github.com/user/repo.git
git fetch org1
checkout a new branch where the rebase will be done :
git checkout -b repo1-rebase-from-org1
git rebase org1/master
fix the conflicts, and if everything is ok, reset your master branch with this one :
git checkout master
git reset --hard repo1-rebase-from-org1
be sure everything work, and all conflict are fixed before push -f
on github.com
Upvotes: 1