-1

I have a private repository which someone forked. He created a branch in his forked repository, made some changes, and created a pull request back to the original repository which is owned by me.

I can see his Pull request as well as the branch in my PR section. I have a clone of my repository in my local machine and I want to pull that branch into my local and make some changes to it.

I don't know how to do it. Can someone help?

P.s.: I cannot find his branch when I do -> git branch or ```git branch -R``

1 Answers1

2

You should add a remote (e.g. 'forked') with the forked repo's URL.
Then you need to fetch forked repo's branches to see that branch!

$ git remote add forked <forked_repo_url>

$ git fetch forked

$ git branch --all
# should see a branch like remotes/forked/<branch_name>
Sajib Khan
  • 22,878
  • 9
  • 63
  • 73
  • I tried adding the remote. Since this is a private repository which means the fork is private as well. I cannot seem to fetch that as I am not the user. `remote: User permission denied fatal: unable to access 'https://example.com/user/reponame/': The requested URL returned error: 403` FYI: I have changed info in the URL for privacy purposes. – Kaushal Bhavsar Aug 31 '21 at 16:24
  • ok! Maybe then you can ask for "**Allow edits from maintainers**". [See Details here](https://docs.github.com/en/github/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork) – Sajib Khan Aug 31 '21 at 19:35