Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve merge conflicts across forks?

I have forked my repo say repoB from another repo say repoA. Now I don't have permissions to write into repoA.

When I try to create a pull request on repoA to get the latest changes and merge those in to repoB I get a merge conflict error. How do I solve that?

I tried this:

git checkout -b repoA master
git pull https:repoA master

git checkout master
git merge --no-ff repoA
git push origin master

N.B. I cannot checkout forkA as I don't have write permissions on that.

like image 788
Pritam Banerjee Avatar asked Aug 15 '16 05:08

Pritam Banerjee


People also ask

Can you merge a forked repo?

Simply push your development branch to the forked remote repository and create the pull request as described in the linked article. The owner of the original repository can then add your repository as a new remote repository, fetch your changes and merge your development branch back into the master branch.


1 Answers

First add the upstream remote

git remote add upstream https://repoA
git fetch upstream

Merge in upstream changes

git checkout master
git merge upstream/master

Resolve conflicts and push

git push origin master

Your pull request should automatically update

like image 88
Jeff Puckett Avatar answered Oct 31 '22 09:10

Jeff Puckett