0

I have two branches, in that one is master branch and another is development branch.

I have been trying to move commits from development to master using cherry-pick method. This method worked well for me if the commit has edited or updated in any one file. But in my scenario, The two to three files edited and pushed in single commit. I need to move those commit to my master branch.

So when I tried cherry-pick, I couldn't move it out. I was able to move only single-file edited in single commit and wasn't able to move multi-files edited in single commit. I am looking out here solution for the issue.

Balaji_Pisces
  • 391
  • 2
  • 3
  • 14
  • What happened when you tried to cherry-pick the commit that edited multiple files? – Aleksey Tsalolikhin May 12 '20 at 18:27
  • When I tried with 3 files, it got conflicted in 2 files and one file was not conflicted in moving by cherry-pick.. same thing was happened when I tried with 4 files.. 3 files were conflicted and 1 file was not conflicted. – Balaji_Pisces May 12 '20 at 18:35

2 Answers2

1

You can use git cherry-pick, you'll just have to resolve your merge conflicts. See How to resolve merge conflicts in Git

Aleksey Tsalolikhin
  • 1,518
  • 7
  • 14
  • Thanks Aleksey Tsalolikhin. The link you shared which helped to solve the conflicts in my files and was able to move commits to my ```master``` branch using ```cherry-pick``` method now. – Balaji_Pisces May 14 '20 at 11:56
1

suppose commit-a, commit-b commit-c are your three commits on development branch which you want to move to master To move first commit, run:

git cherry-pick <sha-id-of-commit-a>

resolve the conflicts, add to index and run

git cherry-pick --continue

then move the second commit

git cherry-pick <sha-id-of-commit-b>

resolve the conflicts, add to index and run

git cherry-pick --continue

then move the third commit

git cherry-pick <sha-id-of-commit-c> 

resolve the conflicts, add to index and run

git cherry-pick --continue