IntelliJ Diff Tool in SourceTree

16,890

Solution 1

Took some time to figure out arguments. Diff command text box should contain path to intellij, like: /Applications/IntelliJ\ IDEA\ 12.app/Contents/MacOS/idea

enter image description here

Solution 2

For OSX android studio i've accomplished with this steps:

Open IntelliJ/Android Studio -> Tools -> Create Command Line Launcher

Something like this:

After that, open SourceTree Preferences: and put "/usr/local/bin/studio" in Diff/Merge Command. Like this:

 Like This:

Diff Arguments:

diff $LOCAL $PWD/$REMOTE

Merge Arguments:

merge $PWD/$LOCAL $PWD/$REMOTE $PWD/$BASE $PWD/$MERGED

And if everything it's ok it should work.

Solution 3

Windows
Diff Command: C:\Program Files (x86)\JetBrains\IntelliJ IDEA 12.1.2\bin\idea.exe
Arguments: diff $LOCAL $PWD/$REMOTE

Merge Command: C:\Program Files (x86)\JetBrains\IntelliJ IDEA 12.1.2\bin\idea.exe
Arguments: (This isn't working right for me. I'm having pathing problems.) merge $LOCAL $PWD/$REMOTE $PWD/$BASE $MERGED


As of 12.1, these are the arguments for using IntelliJ's diff and merge tools from outside the program:

Diff tool
<path to IntelliJ IDEA launcher> diff <path to file1> <path to file2>

Merge tool
<path to IntelliJ IDEA launcher> merge <path to file1> <path to file2> <path to file3> <path to output>

OFFICIAL DOCUMENTATION: running-intellij-idea-as-a-diff-or-merge-command-line-tool


FWIW, I ended up using IntelliJ for my source control. I like it more than Sourcetree. It's quite robust.

Solution 4

For today (January 2019) it works at windows like this:

External Diff/Merge:

Diff tool:

Diff Command: C:\Program Files\JetBrains\WebStorm 2018.3.1\bin\webstorm64.exe

Agruments: diff $LOCAL $REMOTE

Merge Tool:

Diff Command: C:\Program Files\JetBrains\WebStorm 2018.3.1\bin\webstorm64.exe

Agruments: merge $LOCAL $REMOTE $BASE $MERGED

Solution 5

On Mac with intellij 2016

diff $LOCAL $PWD/$REMOTE

merge $PWD/$LOCAL $PWD/$REMOTE $PWD/$BASE $PWD/$MERGED
Share:
16,890
ThanksBro
Author by

ThanksBro

Updated on July 06, 2022

Comments

  • ThanksBro
    ThanksBro almost 2 years

    Is it possible to use IntelliJ Diff tool in SourceTree? I know it is accessible from terminal.

    Thanks

  • ThanksBro
    ThanksBro almost 11 years
    I am using intellij for conflicts and diff, but I use sourcetree for regular stuff.
  • Shad
    Shad about 9 years
    I tried to use Intellij as merge tool but I'm getting errors as it doesn't get the correct temporary files created by Source Tree. It's like it doesn't wait Source tree finishes to create the temporaries, Then it gets a wrong number reference.
  • Ricardo
    Ricardo over 8 years
    It's similar for WebStorm (tested on Yosemite & latest versions of WS and ST). Diff command: /Applications/WebStorm.app/Contents/MacOS/webstorm Arguments: diff $LOCAL $PWD/$REMOTE
  • Ricardo
    Ricardo over 8 years
    Please be careful with extra empty spaces. Full path is needed, even if the parent dir is on $PATH
  • Structed
    Structed about 8 years
    you might need to use a launcher script on non.windows systems: jetbrains.com/help/idea/2016.1/…
  • zur4ik
    zur4ik almost 6 years
    Is it possible to create static launcher for windows? I use EAP version and path of IDE executable changes on every update because one of the folders in path has version in name
  • Steve Henty
    Steve Henty over 4 years
    This has been driving me nuts for months. Thank you for the guidance! I've used Jetbrains with Sourcetree successfully for years, but recently couldn't make the old methods work. FWIW, I had to add -n option to force a new process, and I'm using the commercial version so my -b string is just com.jetbrains.intellij. Now I'm back in business, albeit strangely. The command line script should have worked.
  • Steve Henty
    Steve Henty over 4 years
    FWIW, my system config (that applies to the modifications in the previous comment) is: OSX: 10.13.6 JBToolbox: 1.15.5796 IntelliJ: 2019.2.2 (Ultimate Edition) SourceTree: 3.2.1 (225)
  • Douglas Kazumi
    Douglas Kazumi almost 4 years
    The accepted answer should be stackoverflow.com/a/38587972/4266287