In addition to meld-specific parameters, you now have new Git options:
With Git 2.31 (Q1 2021), "git mergetool
"(man) feeds three versions (base, local and remote) of a conflicted path unmodified.
The command learned to optionally prepare these files with unconflicted parts already resolved.
See commit 9d9cf23, commit de8dafb, commit 98ea309 (09 Feb 2021) by Seth House (whiteinge
).
(Merged by Junio C Hamano -- gitster
-- in commit 78a26cb, 17 Feb 2021)
mergetool
: add hideResolved
configuration
Original-implementation-by: Felipe Contreras
Signed-off-by: Seth House
The purpose of a mergetool is to help the user resolve any conflicts that Git cannot automatically resolve.
If there is a conflict that must be resolved manually Git will write a file named MERGED which contains everything Git was able to resolve by itself and also everything that it was not able to resolve wrapped in conflict markers.
One way to think of MERGED
is as a two- or three-way diff.
If each "side" of the conflict markers is separately extracted an external tool can represent those conflicts as a side-by-side diff.
However many mergetools instead diff LOCAL
and REMOTE
both of which contain versions of the file from before the merge.
Since the conflicts Git resolved automatically are not present it forces the user to manually re-resolve those conflicts.
Some mergetools also show MERGED
but often only for reference and not as the focal point to resolve the conflicts.
This adds a mergetool.hideResolved
flag that will overwrite LOCAL
and REMOTE
with each corresponding "side" of a conflicted file and thus hide all conflicts that Git was able to resolve itself.
Overwriting these files will immediately benefit any mergetool that uses them without requiring any changes to the tool.
No adverse effects were noted in a small survey of popular mergetools so this behavior defaults to true
.
However it can be globally disabled by setting mergetool.hideResolved
to false
.
See "Mergetools: Stop doing three-way merges!"
git config
now includes in its man page:
mergetool.hideResolved
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 overwriten so
that only the unresolved conflicts are presented to the merge tool.
Can
be configured per-tool via the mergetool.<tool>.hideResolved
configuration variable. Defaults to true
.
In the OP's case:
git config --global mergetool.meld.hideResolved true
This is described in:
mergetool
: add per-tool support and overrides for the hideResolved flag
Helped-by: Johannes Sixt
Helped-by: Junio C Hamano
Signed-off-by: Seth House
Add a per-tool override flag so that users may enable the flag for one tool and disable it for another by setting mergetool.<tool>.hideResolved
to false
.
In addition, the author or maintainer of a mergetool may optionally override the default hideResolved
value for that mergetool.
If the mergetools/<tool>
shell script contains a hide_resolved_enabled
function it will be called when the mergetool is invoked and the return value will be used as the default for the hideResolved
flag.
hide_resolved_enabled () {
return 1
}
Disabling may be desirable if the mergetool wants or needs access to the original, unmodified 'LOCAL' and 'REMOTE' versions of the conflicted file.
For example:
- A tool may use a custom conflict resolution algorithm and prefer to ignore the results of Git's conflict resolution.
- A tool may want to visually compare/constrast the version of the file from before the merge (saved to 'LOCAL', 'REMOTE', and 'BASE') with Git's conflict resolution results (saved to 'MERGED').
git config
now includes in its man page:
mergetool.<tool>.hideResolved
Allows the user to override the global mergetool.hideResolved
value
for a specific tool.