0

I have created a file called test. in it i made two commits from master branch content inside the test file is 1(1st commit) & 2(2nd commit), i have created a feature branch, in it i have made three commits as follows 3(3rd commit)),4(4th commit),5(5th commit).now there are 5 commits totally, 2 is in master branch & 3 is in feature branch.

Now i need to pick only the fourth commit that i have in feature branch. as i have checked out to the master branch i am entering git cherry-pick commit-i'd. but its throwing the error which is

git cherry-pick bb87e7b
error: could not apply bb87e7b... Fourth Commit
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'

i sensed where the problem is...the master branch doesn't have third commit which feature branch do. so obviously the third commit content will be missing in the master branch. but as per cherry-pick's logic we should be able to do this action in one way or other.

If anyone knows the answer please explain in-detial or if you needed any supporting document to solve this error reply here. i will share that here. Thank you!

eftshift0
  • 26,375
  • 3
  • 36
  • 60

1 Answers1

0

Well... it fails not because the 3rd commit is missing per se. It fails because the changes introduced on commit 4 started (on commit 3) from content that is different from what you have in commit 2. In that case git can't just guess what to do and that's why you have a conflict. So, take care of the conflict, the way conflicts are dealt with, finish the cherry-pick and you are done.

eftshift0
  • 26,375
  • 3
  • 36
  • 60