Search code examples
windowsgitwebstormgit-difftool

WebStorm git difftool -d closes immediately without waiting for user


Running git difftool -d <commit> <commit> on Windows opens the WebStorm diff tool but the contents disappear as soon as it starts.

Tried trustExitCode, prompt and the bat file.

[diff]
        tool = webstorm
[difftool "webstorm"]
        cmd = \"C:/Users/<me>/AppData/Roaming/JetBrains/WebStorm 2018.1.2/bin/webstorm64.exe\" diff \"$LOCAL\" \"$REMOTE\"

Solution

  • This happens because JetBrains WebStorm is already open so the diff is passed off to the existing instance and the diff command returns. As soon as it returns, git does a cleanup and poof the contents are gone.

    Solutions:

    1. Close WebStorm before diff. Only useful if not using WebStorm for editing.
    2. Hold the shell with sleep or cmd //c "pause". After closing the diff window, return to shell and press Ctrl+c. Or start the difftool as git difftool -d <commit> <commit> &.

      • cmd = \"C:/Users/<me>/AppData/Roaming/JetBrains/WebStorm 2018.1.2/bin/webstorm64.exe\" diff \"$LOCAL\" \"$REMOTE\" && sleep 3600

    Similar issue on Mac: Using IntelliJ as git mergetool always exits as soon as soon as it starts