Assuming I have two repositories called repositoryA
and repositoryB
. I need to merge a commit abcdefgh
which is in a branch in repositoryA
and called branchA
to another branch called branchB
and located in repositoryB
.
in repositoryB:
git checkout -b branchB
git remote add repositoryA git@github.com:xxx/repositoryA.git
git remote update
git cherry-pick abcdefgh
This doesn't work, when I merge, it merges the entire branchA to branchB and makes a lot of conflicts and cherry-pick and above it fails.
The first two steps as you mentioned are good! But then instead of
git remote update
do
git fetch repositoryA branchA
and then you can cherry pick
git cherry-pick abcdefgh