1

I have branch say, develop which has following commits :-

Commit A -> Commit B -> Commit C -> Commit D -> Commit E (where, E being the latest commit in this branch)

Let us suppose that I want to merge the changes from this branch (develop) into another branch, master from commit id C to E (i.e. C, D and E). Can I use the cherry-pick method by picking up individual commits starting from C to E or if there is any better way to achieve it in doing merge in one shot.

Please advise, Thanks

1

1 Answer 1

1

Yes, you can simply cherry pick it.

  1. Check your Git Log using git log command
  2. copy all the commit hashes you need and paste in a notepad in same order
  3. Make a new branch from master
  4. Cherry-pick each commit one by one in the same order.use this command each time to cherry-pick git cherry-pick YOUR_COMMIT_HASH

You have to cherry-pick in the same order if each commit is depending on other commits. If not you can mix your commits. Sometimes you may get conflicts if you have any dependent codes in your commits. then you have to resolve conflicts and run git cherry-pick --continue to continue the process.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.