Reputation: 911
Is it possible to use IntelliJ Diff tool in SourceTree? I know it is accessible from terminal.
Thanks
Upvotes: 34
Views: 19609
Reputation: 1
Got IntelliJ to work as SourceTree's diff and merge tool with
using
Diff Command: open
Arguments: -W -b com.jetbrains.intellij.ce --args diff "$LOCAL" "$PWD/$REMOTE"
Merge Tool: open
Arguments: -W -b com.jetbrains.intellij.ce --args merge "$PWD/$LOCAL" "$PWD/$REMOTE" "$PWD/$BASE" "$PWD/$MERGED"
at SourceTree > Preferences > Diff
.
See https://i.sstatic.net/YEQEV.png for a screenshot.
Hope this helps somebody :-)
Upvotes: 0
Reputation: 151
I recently discovered a more convenient way to use IntelliJ Diff Tool without any settings at all.
This way works perfectly.
Upvotes: 3
Reputation: 151
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
Upvotes: 12
Reputation: 2005
For OSX android studio i've accomplished with this steps:
Open IntelliJ/Android Studio -> Tools -> Create Command Line Launcher
After that, open SourceTree Preferences: and put "/usr/local/bin/studio" in Diff/Merge Command. 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.
Upvotes: 32
Reputation: 3096
Using PHPStorm 2013 on Windows and Sourcetree >2.4 I had to escape the arguments and add a full path to the merge options.
Diff / Merge command:
C:\Program Files\JetBrains\PhpStorm 2017.3.6\bin\phpstorm64.exe
diff arguments:
diff \"$LOCAL\" \"$REMOTE\"
merge arguments:
merge \"$PWD/$LOCAL\" \"$PWD/$REMOTE\" \"$PWD/$MERGED\"
merge \"$PWD/$LOCAL\" \"$PWD/$REMOTE\" \"$PWD/$BASE\" \"$PWD/$MERGED\"
Jetbrans docs command line merge
Upvotes: 1
Reputation: 6073
As @Shad mentioned, IntelliJ may not perform a diff/merge in Windows because the temporary files have not yet been created.
A workaround is to create a file delayed-intellij.bat
as follows:
ping 127.0.0.1 -n 2 > nul
"C:\Program Files\JetBrains\IntelliJ IDEA 2017.2.1\bin\idea64.exe" %*
Then use this file in Sourcetree: C:\temp\idea64-delayed.bat
, and it will launch the merge tool with a short delay.
Upvotes: 0
Reputation: 6732
On macOS with IntelliJ IDEA CE.
Diff Command: open
Arguments: -W -b com.jetbrains.intellij.ce --args diff "$LOCAL" "$PWD/$REMOTE"
Where:
open
: System command to open files and directories.-W
: Causes open
to wait until the applications it opens (or that were already open) have exited.-b com.jetbrains.intellij.ce
: Bundle identifier for the application to use when opening the file.--args
: All remaining arguments are passed to the opened application in the argv
parameter to main()
.Upvotes: 0
Reputation: 17745
On Mac with intellij 2016
diff $LOCAL $PWD/$REMOTE
merge $PWD/$LOCAL $PWD/$REMOTE $PWD/$BASE $PWD/$MERGED
Upvotes: 5
Reputation: 498
For the merge-tool on windows, these arguments work for me:
merge $PWD/$LOCAL $PWD/$REMOTE $PWD/$MERGED
Upvotes: 1
Reputation: 7226
If somebody is interested in Android Studio settings in Mac:
<path to IntelliJ IDEA launcher>:
/Applications/Android\ Studio.app/Contents/MacOS/studio
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>
The only problem which I notice is that Android Studio cannot show more than 1 diff at once. When I try, it complains that the file cannot be showed
Upvotes: 5
Reputation: 10516
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.
Upvotes: 13
Reputation: 9374
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
Upvotes: 19