Reputation: 6547
So,
I have the following situation. There is the original repo on github: Repo A
. Also there is a fork that contained some great additions to that repo: Repo B
.
So I forked Repo B and added some nice code. I created a pull request and the owner of Repo B
asked me to make a pull request directly to Repo A
instead.
The situation looks like this now:
Repo A (original)
|
▼
Repo B (some great features)
|
▼
Repo C (my fork, has some changes that need to go to Repo A directly)
But I cannot make a pull request directly to Repo A
that hold only my changes. The reason is that there are several other changes (made to Repo B
) that my change was based on. What I get when I create a pull request at the moment is all the changes made to Repo B
plus the change I made to Repo C
.
On github, I cannot make a second fork of a project since the name is already used.
So, what should I do now? Is there a command line work around to get this solved?
Upvotes: 4
Views: 373
Reputation: 9197
Add Repository A as a remote to your local repository:
git remote add repo-a <url>
git fetch repo-a
Create your own branch based on the branch you should open a pull request against. This is conventionally master
, but check the README
or CONTRIBUTING
files for instructions.
git checkout -b my-feature repo-a/master
Now, you're on a branch called my-feature
(name this for what you've done). Use cherry-pick
to get the commit you made onto this branch where <hash>
is the hash of your commit:
git cherry-pick <hash>
You now have a local branch ready for a pull request. Push that branch to your fork to publish it (assuming origin
is the name of the remote for your fork):
git push origin my-feature
You can now open a pull request from my-feature
on your fork to master
in Repository A.
Upvotes: 3