6

I have p4merge configured so that from the command line if I do a "git difftool ... " then the external diff tool opens up correctly.

I would like to open the external difftool from "git gui" instead of the command line. Is this possible?

Is seems git-gui allows one to add a tool. But it is unclear to me how to get it working. Any pointers?

Debajit
  • 46,327
  • 33
  • 91
  • 100

1 Answers1

7

If you already have git difftool set up you can add an item for it:

git-gui Tools->Add dialog difftool setup

Add Tool dialog transcription:

Tool Details box:
    Name: difftool
    Command: git difftool $FILENAME

Show a dialog before running: unchecked
    Ask the user to select a revision (sets $REVISION): unchecked
    Ask the user for additional arguments (sets $ARGS): unchecked

Don't show the command output window: checked
Run only if a diff is selected ($FILENAME not empty): checked
  Add globally: checked

Not super-useful though, since there doesn't seem to be a way to assign a hotkey or double-click action to it.

Might need to add a -y to the difftool command if it's asking you annoying questions.

genpfault
  • 51,148
  • 11
  • 85
  • 139
  • 3
    Thanks. And use `git difftool -y $FILENAME` otherwise it gets stuck in a `Run kdiff3 ?` prompt. – patraulea Dec 08 '16 at 09:43
  • 1
    Double-click support for this is here: https://github.com/patraulea/git/pull/1/files (you'll have to patch /usr/lib/git-core/git-gui) – patraulea Dec 08 '16 at 12:08
  • 1
    Sorry for the very late question. To add insult to injury, it's also a pretty dumb question. This doesn't work with Windows does it? – Saturn K Jun 05 '17 at 21:06
  • @KeyvanSadralodabai: Yup, works fine with Beyond Compare 3 on Windows. Had to use `git difftool -y $FILENAME` to [suppress a startup question](https://stackoverflow.com/questions/7897517/why-does-git-difftool-not-open-the-tool-directly) though. – genpfault Jun 05 '17 at 21:56
  • @genpfault Yes, I added a bunch of commands to it. The double-click script though, I couldn't make it work as it is for Linux only. I'll update if I find a way to do it for Windows. – Saturn K Jun 05 '17 at 22:01