gitgit-mergegit-configgit-merge-conflictmeld

Merging with meld: hideResolved vs useAutoMerge


As far as I know, there are two options to make meld automatically merge the changes which do not conflict.

What is the difference between both options, and which is preferred?

git config --global mergetool.hideResolved true
git config --global mergetool.meld.useAutoMerge true

Solution

  • there are two options to make meld automatically merge the changes which do not conflict.

    This is true for mergetool.meld.useAutoMerge, but not for mergetool.hideResolved.

    What is the difference between both options?

    According to the docs of mergetool.meld.useAutoMerge, meld merges all non-conflicting parts and then highlights the conflicts. Meaning that, both conflicting and non-conflicting content are provided to meld.

    When the --auto-merge is given, meld will merge all non-conflicting parts automatically, highlight the conflicting parts, and wait for user decision.

    Instead, when using mergetool.hideResolved, Git attempts to automatically resolve the conflicts, and produce a MERGED file with all the conflicts that the user has to reconcile. In this scenario, meld is provided with only the unresolved conflicts.

    During a merge, Git will automatically resolve as many conflicts as possible and write the MERGED file containing conflict markers around any conflicts that it cannot resolve; LOCAL and REMOTE normally represent the versions of the file from before Git’s conflict resolution. This flag causes LOCAL and REMOTE to be overwritten so that only the unresolved conflicts are presented to the merge tool.

    Also, when using mergetool.meld.useAutoMerge, it is probably best to set its value to auto, as it makes git detect whether --auto-merge is supported and will only use --auto-merge when available.

    which is prefered?

    This last question is far too generic and possibly opinion-based to be answered. It really depends on what suites you best. All I can say is that: