Question

I have this:

branch-1     a--b--c--d

I need this:

branch-1     a--c--d
branch-2     b

I tried this:

$git checkout -b branch-2
$git cherry-pick <SHA-1 b>

But I got this:

error: could not apply <SHA-1 b>... [comment]
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'

So I did $git status and got Unmerged paths ... both modified: .gitignore. I git added and git committed before trying again, only to get the same error msg again.

How do I move a particular commit onto a new branch?

Était-ce utile?

La solution

When you commited the merge, that completed the cherry-pick on branch-2. You shouldn't run cherry-pick again. Cherry-pick won't change the history of branch-1 so you'll need to use interactive rebase to do that.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top