We are using Gitlab free self-hosted 13.8.4-ee. During merge conflicts, we would like Git to save the state of unresolved conflicts in a merge as it is, so that we are able to continue resolving the conflicts at a later time.
We checked that in Gitlab UI's Merge tool, it is not possible. The 'Draft' option in 'Merge Requests' only makes the merge in a non-ready state, but we are unable to save resolved and unresolved conflicts, since git mergetool would resolve the unresolved conflicts with the version from BASE (common ancestor) rather than keep the local copy. We also checked that this is not possible in external merge tools like Beyond Compare or Meld. Even when checked in Github's free version, it is not allowing to save/close the merge until all conflict markers are removed.
Is there a way where we can save the current merge state in Git? In TFS, it is possible to save the current merge state as it is.
Please check the answer from previous question : Git merge for conflict cases replaces local copy with the common ancestor copy
You can't.
More precisely, the way you save anything permanently (or even for just a day or so, or for transport purposes, etc.) in Git is by making commits. But when you're in the middle of a conflicted merge, you cannot make any new commits. You want to save stuff so that the merge can be continued elsewhere. So you're in a Catch-22 situation: you want to save the conflict, but to do that, you must first completely resolve the conflict, after which there's no conflict to save.
Git does need a facility for this, and there are several possible approaches for adding one, but—as far as I know at least—nobody has made it all the way through adding one.
(It's not a matter of whether files have conflict markers in them, though ideally the "preserve partial but conflicted merge" would preserve and then restore these conflict markers too. The actual problem is that the index has nonzero staging numbers in it. These nonzero staging numbers are what prevents writing out a tree, and without the ability to write trees, there's no way to save the various files.)