hint: after resolving the conflicts, mark the corrected paths

GitGit MergeGit RevertGit Cherry-PickGit Merge-Conflict

Git Problem Overview


git sometimes gives me this message on a conflict (during a revert or cherry pick)

hint: after resolving the conflicts, mark the corrected paths

What does this mean?

Git Solutions


Solution 1 - Git

This means that you need to explicitly tell Git that you've resolved a conflict at each file or folder (that is path).

Showing the list of yet unresolved conflicts:

git status

Marking a conflict as resolved.

File or all files in a folder should be left and all conflicts are resolved:

git add

File or folder should be removed:

git rm

Next step:

git commit

Solution 2 - Git

because some files are in conflict ,you can type git status to find out what is the file with conflict, and after the conflict was sovled ,just git commit -m sth log ,at last git cherry-pick your-commmit-id . see details http://wiki.koha-community.org/wiki/Using_Git_Cherry_Pick#Resolve_conflicts

Solution 3 - Git

This... can be confusing, and with Git 2.34 (Q4 2021), the advice message that "git cherry-pick"(man) gives is clearer:

When it asks conflicted replay of a commit to be resolved by the end user, it now (Git 2.34, Q4 2021) says:

  • for 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`.
  • for 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`.

See commit f172556 (22 Aug 2021) by ZheNing Hu (adlternative).
(Merged by Junio C Hamano -- gitster -- in commit 173368d, 10 Sep 2021)

> ## cherry-pick: use better advice message
> Mentored-by: Christian Couder
> Mentored-by: Hariom Verma
> Helped-by: Phillip Wood
> Helped-by: Junio C Hamano
> Signed-off-by: ZheNing Hu

> "git cherry-pick"(man), upon seeing a conflict, says:
> > > 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`. > > As if running "git commit" to conclude the resolution of this single step were the end of the story.
> > This stems from the fact that the command originally was to pick a single commit and not a range of commits, and the message was written back then and has not been adjusted.
> > 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 the range dealt with, "--skip" to drop the current commit, or "--abort" to discard the series.
> > Suggest use of "git cherry-pick --continue/--skip/--abort so that the message also covers the case where a range of commits are being picked.
> > Similarly, this optimization can be applied to git revert(man), suggest use of "git revert --continue/--skip/--abort so that the message also covers the case where a range of commits are being reverted.
> > It is worth mentioning that now we use advice() to print the content of GIT_CHERRY_PICK_HELP in print_advice(), each line of output will start with "hint: ".

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionpaullbView Question on Stackoverflow
Solution 1 - GitNick VolynkinView Answer on Stackoverflow
Solution 2 - GitxirongView Answer on Stackoverflow
Solution 3 - GitVonCView Answer on Stackoverflow