I, user1
, have a project at github. Another user2
created a fork and made three commits: A
B
and C
.
I want to merge only commits A
and B
back into my project.
How to do it, that I could keep the history in github's network graph?
I, user1
, have a project at github. Another user2
created a fork and made three commits: A
B
and C
.
I want to merge only commits A
and B
back into my project.
How to do it, that I could keep the history in github's network graph?
You can add a remote reference to the fork, create a branch on B, and merge that branch (in, for instance, master
):
git remote add fork /url/of/fork
git fetch --all
git branch tmp fork/B
git checkout master
git merge tmp
I find the merge cleaner than using git cherry-pick
.
The OP Michał Sałaban preferred (in the comments) create the branch with:
git checkout B
git branch tmp
I suggest to use github pull request.
GIthub pull request help: https://help.github.com/articles/using-pull-requests
How?
simple:
open a new branch from your current state
git checkout "COMMIT_B_ID"
this will result in detached HEAD
now create a new named branch
git checkout "MY_B_BRANCH"
git push origin MY_B_BRANCH
now github contains new branch with your changes. Go to github and open a pull reauest to merge the new branch with the master
This way (Pull requsest) you can see and verfiy that this is exactly what needs to be commited.
Godd Luck.