Thread (9 messages) flat view 9 messages, 3 authors, 2016-06-15

Re: Apply commits from one branch to another branch (tree structure is different)

From: Andrew Wong <hidden>
Date: 2016-06-15 23:00:19

On Fri, Mar 14, 2014 at 4:57 PM, Jagan Teki [off-list ref] wrote:
Mr.J> git cherry-pick -X subtree=foo
cc70089614de16b46c08f32ea61c972fea2132ce
14e9c9b20e3bf914f6a38ec720896b3d67f94c90
error: could not apply cc70089... AAAAAAAAAAAAAAAAA
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'
Mr.J> ls
foo
Mr.J> gs
# On branch branch2
# Unmerged paths:
#   (use "git add/rm <file>..." as appropriate to mark resolution)
#
#    deleted by us:      foo/foo_v2/test.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
Does the foo_v2/test.txt file already exist in branch2 before you try to apply?
i.e. does foo/test.txt exist in branch2?

What might be happening is: the commit modifies foo_v2/test.txt on
branch1, but foo/test.txt doesn't exist on branch2. So even when you
use the subtree option, there's no foo/test.txt on branch2 to
"receive" the changes of foo_v2/test.txt. This is an actual conflict
that git doesn't know what to do, so you have resolve it. This
probably means one of two things for you:

1. You _want_ foo/test.txt on branch2, then:
        git add foo/foo_v2/test.txt    # get the entire test.txt file
from that commit on branch1
        git mv foo/foo_v2/test.txt foo/test.txt    # move/rename the
file to the right location
2. You _don't_ want foo/test.txt on branch2, then:
        git rm foo/foo_v2/test.txt    # just remove it

And then run "git cherry-pick --continue" to continue with the cherry-pick.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help