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

Vinod Kumar
  • 665
  • 3
  • 13
  • 31
  • Duplicate of https://stackoverflow.com/questions/9339429/what-does-cherry-picking-a-commit-with-git-mean/39119678#39119678 – Vijay S B Aug 08 '18 at 13:36

1 Answers1

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.

isuruAb
  • 2,202
  • 5
  • 26
  • 39