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 add
ed and git commit
ted before trying again, only to get the same error msg again.
How do I move a particular commit onto a new branch?
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.