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
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:
From a merge perspective, if you want to rely on Git for merging changes, then use mergetool.hideResolved
. Instead, if you want to delegate the conflict resolution to an external tool, then use mergetool.meld.useAutoMerge
.
From a parameter perspective, if you want to focus only on conflicts, go with mergetool.meld.hideResolved
, as only conflicting hunks are provided. Instead, if you want a broader picture while reconciling conflicts, go with mergetool.meld.useAutoMerge
, since both conflicting and non-conflicting content are provided.