Using IntelliJ as git mergetool always ends as soon as it starts

I configured IntelliJ as my diff and mergetool on my mac, but git launches it, the command line always returns immediately, and does not wait for the parsing to complete, which means that the changes are not reflected on the disk.

My configuration:

[mergetool "intellij"] cmd = /Applications/IntelliJ\\ IDEA\\ 13\\ CE.app/Contents/MacOS/idea merge \ $(cd $(dirname \"$LOCAL\") && pwd)/$(basename \"$LOCAL\") \ $(cd $(dirname \"$REMOTE\") && pwd)/$(basename \"$REMOTE\") \ $(cd $(dirname \"$BASE\") && pwd)/$(basename \"$BASE\") $(cd $(dirname \"$MERGED\") && pwd)/$(basename \"$MERGED\") trustExitCode = true 

I tested the IntelliJ call manually without git, and it also returns immediately, so I don’t think it was caused by the git call, rather, the IntelliJ command line call just sends a message to open a window to an existing running IntelliJ instance .. Is there a way to force IntelliJ not return or create a new instance to make this work?

+5
source share
1 answer

There is no way to do this. There are three workarounds:

  • Close an existing application before using diffftool. If there are no open windows, the merge will work correctly.

  • Use a second IntelliJ instance with different caches and a home configuration But be careful with licensing the second instance. If you use a license server, for example, both instances will take the license from the server.

  • Add something like a pause (on Windows) to the running script. This way git will call the BAT file (on Windows), and that BAT file will call IntelliJ, and then wait for the input. After you have done everything you need, you must return to the console and press any key manually.

+2
source

Source: https://habr.com/ru/post/1201697/


All Articles