21

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.

2
  • @AndreasPapadopoulos I can compare a branch from Eclipse Git Tool by just checking out the branch I want to compare to. Here I cannot checkout the master branch of the repo that I forked from, so how do I compare? Aug 15, 2016 at 6:03
  • 1
    Why can't you "checkout the master branch of the repo that I forked from". This is a read-only action. It should work. Maybe you have a different problem. Like you want to check out the branch with a name that you already have checked out (but with a different upstream)? Aug 15, 2016 at 8:16

1 Answer 1

47

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

4
  • I'm having problems with this too but not sure what branch to where. If I created a pull request of branch-x into branch-y and there are conflicts how do i pull the conflicts to local branch-x so i can fix. Any pointers welcome!
    – v3nt
    Aug 22, 2018 at 14:40
  • 1
    @v3nt you would fetch the remote with branch-y, then merge branch-y into your branch-x which would throw a bunch of conflicts for resolution. when you've solved those, then commit and push up branch-x to update the PR clearing conflicts. Aug 22, 2018 at 16:09
  • For those coming here who want to do this in SourceTree, this SO answer has some good instructions on how to do this.
    – Neo
    May 29, 2019 at 12:03
  • @JeffPuckett can you write out the commands for that?
    – Sam
    Nov 16, 2022 at 17:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.