Can we cherry-pick commits from two different branches into a third branch? For suppose I have two branches(develop and master). I created two branches A and B from develop and merged them into the develop branch.
I want to cherry-pick the changes I merged into develop branch to the master branch.
Can we do that? If so, how?
you simply have to checkout master
git checkout masterand then for each commit you want to cherry-pick from
develop(or fromaor fromb)git cherry-pick -x <SHA of commit>or if you want you can use a range whereAis the oldest to grab andBis newest and wantA,B, and everything in between:git cherry-pick -x A..Bthat said as others have mentioned it might make more sense to simply merge
developintomasterunless there are other items ondevelopthat can't be merged yet. If you can't things do get more complicated. In that case I would consider rebasingAandBon top of master first usingrebase --ontoyou'll need some more syntax you can find on the web for that, merging them into master, and then merging master into develop to unify things. but if you want to cherry pick, go ahead.