Home > Blockchain >  Merge a commit from a branch in repositoryA to a branch in repositoryB
Merge a commit from a branch in repositoryA to a branch in repositoryB

Time:01-03

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 [email protected]: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.

CodePudding user response:

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
  • Related