且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

压倒一切替代樱桃采摘

更新时间:2023-01-23 17:19:42

You could use the merge strategy option 'theirs':

git cherry-pick <SHA-1> -Xtheirs

Where <SHA-1> is the hash of the commit you want to cherry pick into your branch.

This means that, in case of conflict, Git would always resolve it with the version of commit being cherry-picked ("theirs").


Note that, even without that option, you can do the same manually (but that would not scale well with many files)

git cherry-pick <SHA-1>
error: could not apply <SHA-1>... [Commit Message]
hint: after resolving the conflicts, mark the corrected paths

git checkout --theirs path/to/conflicted_file.php
git add path/to/conflicted_file.php