I have a huge commit, which I cherry-picked. The pick now creates a sum of conflicts (in working-tree). Now I would like to commit all the staged (successfully merged) changes without having to resolve all conflicts.
Naively I always thought, commit would only work on the stage, but when I try, I get the message, that I cannot commit without resolving the conflicts.
Can someone explain to me what is going on and how I could fix it.
You have to resolve the conflicts as conflicts only happen when git cannot automatically merge the branches. They mostly occur when the same line was modified in 2 separate commits.
Example
master branch:
branch A and B was branched off from master
Commit x applied on branch A
Diff
Commit y applied on branch B
Diff
When you merge branch A and try to merge branch B afterwards into master, git cannot decide what to put for L2. Whilst resolving the conflicts you have to make that decision.
How to resolve the conflicts
Easiest way to resolve is selecting which version of the file you want to keep.
To select the version of the file that is on the current branch (HEAD)
To select the version of the file that is on the other branch (the branch that you pulled / cherry-picked from. possibly the remote branch):
Or you can edit the files one by one and removing the conflict markers (
<<<<<<<
,=======
,>>>>>>>
) and picking which version to useAfterwards you need to mark them as resolved by doing:
Tip: You can use
.
as the filename to select all the files under the current directory.