Thread (1 message) 1 message, 1 author, 2017-01-26

Re: Force Confirmation for Dropping Changed Lines

From: Junio C Hamano <hidden>
Date: 2017-01-26 20:57:32

Hilco Wijbenga [off-list ref] writes:
On 25 January 2017 at 18:32, Junio C Hamano [off-list ref] wrote:
quoted
I think you should be able to do something like

        $ cat >$HOME/bin/fail-3way <<\EOF
        #!/bin/sh
        git merge-file "$@"
        exit 1
        EOF
        $ chmod +x $HOME/bin/fail-3way
        $ cat >>$HOME/.gitconfig <<\EOF
        [merge "fail"]
                name = always fail 3-way merge
                driver = $HOME/bin/fail-3way %A %O %B
                recursive = text
        EOF
        $ echo pom.xml merge=fail >>.gitattributes

to define a custom merge driver whose name is "fail", that runs the
fail-3way program, which runs the bog standard 3-way merge we use
(so that it will do the best-effort textual merge) but always return
with a non-zero status to signal that the result is conflicting and
needs manual resolution.
Thank you, that's an improvement. :-) Unfortunately, it still
completes the merge. Is there any way to simply get the
quoted
quoted
quoted
quoted
quoted
quoted
quoted
quoted
/<<<<<<<< markers?
You can, but you need to write one yourself without relying on "git
merge-file", because the whole point of the 3way merge we implement
(including in that program) is "do not bother the user when both
sides made the same change."
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help