Reputation: 282
Ok I have a possibly unique situation
I have two repository, in different organizations (B is not a fork of A but a clone), but both on GitHub. One I'm an admin of (B), the other I'm a collaborator with read access only (A).
To be clear, I am owner of neither so I can't delete and fork instead.
I need to submit a pull request from repository B to repository A. Is this even possible? If so, how!
Upvotes: 5
Views: 3354
Reputation: 12280
Based on the clarifications in the comments, here is a complete solution that should work for you:
Step 1. Go to GitHub and fork A to create A-fork.
Step 2. Clone your fork:
git clone <URL for A-fork>
Step 3. Add B as a second remote to the same sandbox and checkout the branch you have to submit as a Pull Request - I'll call it branch-for-PR
:
git remote add B <URL for B>
git fetch B
git checkout branch-for-PR
Step 3 b. If branch-for-PR
already existed on A-fork, you'll need to merge the state of that branch from B:
git merge B/branch-for-PR
Step 4. Push the branch-for-PR
to A-fork, which is origin
since that's what you cloned in step 2:
git push origin branch-for-PR
Step 5. Go to A-fork on GitHub and create a pull request from branch-for-PR
. That will notify A's administrators as usual.
This would work regardless of where B was hosted, on a private Git repo or under another GitHub user. All you need is to be able to connect to both from the same sandbox.
Upvotes: 5
Reputation: 1677
Yes. As long as they share the enough history (commits), there is no problem.
git remote add repoA $GIT_REPO_URL
).git fetch repoA
Upvotes: 1