简体   繁体   English

如何解决由于在使用樱桃挑选中删除文件而导致的合并冲突?

[英]How do I fix a merge conflict due to removal of a file in a using cherry-pick?

 git cherry-pick --strategy=recursive -X theirs -n "$GitHub_SHA" 

Hello, I'm specifying -s recursive -X theirs, why is it still necessary to git rm and git add?你好,我是指定-s recursive -X theirs,为什么还需要git rm和git add?

Also how do i differentiate when to git rm or git add in my bash script?另外,我如何区分何时添加 git rm 或 git 添加到我的 bash 脚本中?

git cherry-pick --strategy=recursive -X theirs -n "$GitHub_SHA" || merge_conflict=1

   if [ ${merge_conflict:-0} -eq 1 ]
    then
    git add -all
   fi

-X theirs and -X ours act on conflicting hunks. -X theirs-X ours作用于冲突的帅哥。 If a file has been removed by one side, no conflicting hunks are generated.如果文件已被一侧删除,则不会生成冲突的块。 At the same time, the context lines are not generated either.同时,也不生成上下文行。 Without the hunks and context lines, the strategy option cannot pick lines.没有大块头和上下文线,策略选项无法选择线。

To differentiate one conflicting type from another, you could try git status -s and parse the result in short format.为了区分一种冲突类型,您可以尝试git status -s并以短格式解析结果。 For details on short format, see Short Format .有关短格式的详细信息,请参阅短格式 For example, for a deleted by us file foo.txt , git status -s foo.txt prints DU foo.txt .例如,对于deleted by us文件foo.txtgit status -s foo.txt打印DU foo.txt For both modified , it's UU foo.txt .对于both modified ,它都是UU foo.txt

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM