54

git 有时会在冲突时给我这个消息(在恢复或樱桃采摘期间)

hint: after resolving the conflicts, mark the corrected paths

这是什么意思?

4

3 回答 3

52

这意味着您需要明确告诉 Git 您已解决每个文件或文件夹(即路径)的冲突。

显示尚未解决的冲突列表:

git status

将冲突标记为已解决。

应保留文件夹中的文件或所有文件,并解决所有冲突:

git add

应删除文件或文件夹:

git rm

下一步:

git commit
于 2015-06-11T02:57:41.657 回答
5

因为有些文件有冲突,你可以打字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

于 2015-06-11T02:57:17.440 回答
1

git cherry-pick这...可能会令人困惑,并且在 Git 2.34(2021 年第四季度)中,“ ” man给出的建议信息更加清晰:

当它要求最终用户解决提交的冲突重播时,它现在(Git 2.34,Q4 2021)说:

  • 对于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`.

参见F172556(2021 年 8 月 22 日)由ZheNing Hu ( adlternative)提交。
(由Junio C Hamano 合并 -- gitster--提交 173368d中,2021 年 9 月 10 日)

cherry-pick: 使用更好的建议信息

指导者:Christian Couder
指导者:Hariom Verma
帮助者:Phillip Wood
帮助者:Junio C
Hamano 签字者:胡哲宁

" git cherry-pick" ( man )看到冲突时说:

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”来结束这一步的解决方案就是故事的结局。

这是因为该命令最初是选择单个提交而不是一系列提交,并且该消息是当时写的并且尚未调整。

When picking a range of commits, and the command stops with a conflict in the middle of the range, however, after resolving the conflict and (optionally) recording the result with " git commit", the user has to run " git cherry-pick --continue" to have the rest of处理的范围,“ --skip”放弃当前提交,或“ --abort”放弃系列。

建议使用 "git cherry-pick --continue/--skip/--abort以便该消息还涵盖选择一系列提交的情况。

类似地,这种优化可以应用于( man ),建议使用 "以便消息也涵盖一系列提交被还原的情况。git revertgit revert --continue/--skip/--abort

值得一提的是,现在我们advice()用来打印GIT_CHERRY_PICK_HELPin的内容print_advice(),每行输出都会以“hint:”开头。

于 2021-09-19T14:47:48.953 回答