How to git cherry-pick a commit with binary files
Asked Answered
O

1

10

I am trying to cherry-pick a commit from a different branch that is mostly binary files. It seems it is mostly successful, except for one file where I get the message:

warning: Cannot merge binary files: XXXX.so (HEAD vs. d8ef550... Add support for 32-bit apk)
error: could not apply d8ef550... Add support for 32-bit apk
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 can do a 'git add' on that file, but the results are not what I was expecting. I expected it to be a modification, but it turned out to remove that file in question. The commit I am trying to cherry pick modifies some binary files as well as deletes a few.

So, the question is...what is the best way to cherry-pick a commit w binary files ?

Orrery answered 6/6, 2017 at 18:40 Comment(0)
M
22

You can do this with git cherry-pick --strategy=recursive -X theirs {Imported_Commit}

(You may need to abort the current cherry-pick first; git cherry-pick --abort)

Malenamalet answered 6/6, 2017 at 18:46 Comment(1)
Nice. That worked. I just had to explicitly do a 'git rm <filename>' and then I was right where it needed to be. Thanks.Orrery

© 2022 - 2024 — McMap. All rights reserved.