Multiple commits cherry-picking

Nitu Dhaka picture Nitu Dhaka · Dec 20, 2013 · Viewed 33.3k times · Source

I have 33 commits in the main branch that are meshed up. Now I need to maintain the record neatly. So now I have created feature branches and I'm trying to classify those 33 commits in different feature branches. So can it be possible to pick multiple commits at a time to copy in the relevant feature branch? And I am also facing its conflicts when I tried multiple commits with the cherry-pick command.

git cherry-pick A B C

here A, B, C are the commits' hashcode.

Answer

silvio picture silvio · Dec 20, 2013

You do it correct. The synopsis is

git cherry-pick [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] <commit>...

git cherry-pick goes from left to right commit. You can order how you want. If you have a conflict you have three choices. you can git cherry-pick --quit (stop cherry-picking and let your tree in his current state), git cherry-pick --abort (stop cherry-picking and reset your branch to the state where he was before you start git cherry-pick) or resolve this conflict with an editor or with git mergetool and then git cherry-pick --continue go to next commit in your list.