1

Currently I have this gitconfig:

[diff]
    tool = diffmerge
[difftool "diffmerge"]
    cmd = diffmerge \"$LOCAL\" \"$REMOTE\"
[merge]
    tool = diffmerge
[mergetool "diffmerge"]
    cmd = "diffmerge --merge --result=\"$MERGED\" \"$LOCAL\" \"$(if test -f \"$BASE\"; then echo \"$BASE\"; else echo \"$LOCAL\"; fi)\" \"$REMOTE\""
    trustExitCode = true
[alias]
  df = difftool

Everytime I start the difftool via git difftool somefile..somefile, I get prompt:

Hit return to launch 'diffmerge':

How can I set up this prompt so, that if I type "Y" it opens the file, and if "N" it skips it?

William Pursell
  • 204,365
  • 48
  • 270
  • 300
Sonne
  • 691
  • 1
  • 6
  • 20

1 Answers1

0

This is a bit of a hack, but you could do:

[alias]
    df = difftool -y
[difftool "diffmerge"]
    cmd = sh -c 'read -p \"Type Y to launch diffmerge:\" r && \
        test $r = Y \
        && diffmerge \"$LOCAL\" \"$REMOTE\"'

This assumes your read accepts -p. If not, do the standard thing:

cmd = sh -c 'printf \"Type Y to launch diffmerge: \" && read r && test $r = Y \
            && diffmerge \"$LOCAL\" \"$REMOTE\"'
William Pursell
  • 204,365
  • 48
  • 270
  • 300