git 有时会向我提供有关冲突的消息(在恢复或樱桃选择期间)
hint: after resolving the conflicts, mark the corrected paths
这是什么意思?
这意味着您需要明确告诉 Git 您已经解决了每个文件或文件夹(即路径)的冲突。
1。查看尚未解决冲突的文件列表
git status
2。将每个文件标记为已解决
解决文件中的冲突后,将其添加以标记冲突已解决:
git add file-which-had-conflicts
如果您想删除文件而不是解决冲突,请使用
git rm
进行操作。不过,这种情况很少见。
git rm file-which-had-conflicts
3.继续进行变基/合并/其他操作
git rebase --continue
git merge --continue
git cherry-pick --continue
因为有些文件有冲突,你可以输入
git status
来查找有冲突的文件是什么,冲突解决后,只需git commit -m sth log
,最后git cherry-pick your-commmit-id
。查看详细信息http://wiki.koha-community.org/wiki/Using_Git_Cherry_Pick#Resolve_conflicts
这......可能会令人困惑,而在 Git 2.34(2021 年第 4 季度)中,“
git cherry-pick
”(man) 给出的建议消息更加清晰:
当它要求最终用户解决提交的冲突重播时,它现在(Git 2.34,2021 年第 4 季度)说:
git cherry-pick
:After resolving the conflicts, mark them with
`git add`/`rm <pathspec>`, then run
`git cherry-pick --continue`
You can instead skip this commit with `git cherry-pick --skip`.
To abort and get back to the state before `git cherry-pick`
run `git cherry-pick --abort`.
git revert
:After resolving the conflicts, mark them with
`git add`/`rm <pathspec>`, then run
`git revert --continue`
You can instead skip this commit with `git revert --skip`.
To abort and get back to the state before `git revert`
run `git revert --abort`.
参见commit f172556(2021 年 8 月 22 日),作者:ZheNing Hu (
adlternative
)。gitster
-- 合并于 commit 173368d,2021 年 9 月 10 日)
:使用更好的建议消息cherry-pick
导师:Christian Couder
指导者:Hariom Verma
帮助者:菲利普·伍德
帮助者:Junio C Hamano
签字人:胡哲宁
”(man),看到冲突后说:git cherry-pick
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`.
仿佛运行“
”来结束这一步的解决就是故事的结局。git commit
这是因为该命令最初是选择一个single提交而不是range提交,并且消息是当时写的并且尚未调整。
当选择提交的范围时,命令会因范围中间的冲突而停止,但是,在解决冲突并(可选)用“
”记录结果之后,用户必须运行“git commit
”处理其余范围,“git cherry-pick --continue
”删除当前提交,或“--skip
”放弃该系列。--abort
建议使用“
”,以便消息也涵盖正在选择一系列提交的情况。git cherry-pick --continue/--skip/--abort
(man),建议使用“git revert
”,以便该消息也涵盖正在恢复一系列提交的情况。git revert --continue/--skip/--abort
值得一提的是,现在我们使用
来打印advice()
中GIT_CHERRY_PICK_HELP
的内容,每行输出都会以“hint:”开头。print_advice()
git cherry-pick
”(man)在git rebase -i
(man)会话期间调用丢失了作者信息,该信息已使用Git 2.44(2024年第一季度)进行更正,在2.44之前最后.
请参阅 Vegard Nossum (vegard
)
的commit e4301f7(2024 年 2 月 2 日)。
gitster
-- 合并于 commit c036a14,2024 年 2 月 14 日)
:取消设置“exec”命令的sequencer
GIT_CHERRY_PICK_HELP
帮助者:Phillip Wood
签署人:Vegard Nossum
”(man) 作为 x 命令运行会丢失原始作者信息。git cherry-pick
要解决此问题,请取消设置“exec”命令的
。GIT_CHERRY_PICK_HELP