git SourceTree 中的 IntelliJ Diff 工具

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14774053/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 08:08:53  来源:igfitidea点击:

IntelliJ Diff Tool in SourceTree

gitintellij-ideadiffatlassian-sourcetree

提问by ThanksBro

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

是否可以在 SourceTree 中使用 IntelliJ Diff 工具?我知道它可以从终端访问。

Thanks

谢谢

采纳答案by Igor Konoplyanko

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

花了一些时间来找出论据。Diff 命令文本框应包含 intellij 的路径,例如:/Applications/IntelliJ\ IDEA\ 12.app/Contents/MacOS/idea

enter image description here

在此处输入图片说明

回答by firetrap

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

对于 OSX android studio,我已经完成了以下步骤:

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

打开 IntelliJ/Android Studio -> 工具 -> 创建命令行启动器

Something like this:

像这样的东西:

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

之后,打开 SourceTree Preferences: 并将“/usr/local/bin/studio”放在 Diff/Merge 命令中。像这样:

 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.

如果一切正常,它应该可以工作。

回答by Pup

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

Windows
Diff 命令:C:\Program Files (x86)\JetBrains\IntelliJ IDEA 12.1.2\bin\idea.exe
参数: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

合并命令:C:\Program Files (x86)\JetBrains\IntelliJ IDEA 12.1.2\bin\idea.exe
参数:(这对我来说不合适。我遇到了路径问题。)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:

从 12.1 开始,这些是在程序外部使用 IntelliJ 的差异和合并工具的参数:

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

差异工具
<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>

合并工具
<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

官方文档:运行-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.

FWIW,我最终使用 IntelliJ 进行源代码控制。我比 Sourcetree 更喜欢它。它非常坚固。

回答by Oleg Smolovyk

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

今天(2019 年 1 月)它在这样的窗口上工作:

External Diff/Merge:

外部差异/合并:

Diff tool:

差异工具:

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

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

Agruments: diff $LOCAL $REMOTE

Agruments: diff $LOCAL $REMOTE

Merge Tool:

合并工具:

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

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

Agruments: merge $LOCAL $REMOTE $BASE $MERGED

Agruments: merge $LOCAL $REMOTE $BASE $MERGED

回答by Malachiasz

If somebody is interested in Android Studiosettings in Mac:

如果有人对Mac中的Android Studio设置感兴趣:

<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

我注意到的唯一问题是 Android Studio 不能同时显示 1 个以上的差异。当我尝试时,它抱怨无法显示文件

回答by Alkis Kalogeris

On Mac with intellij 2016

在 Mac 上使用 Intellij 2016

diff $LOCAL $PWD/$REMOTE

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

回答by Bas

Using PHPStorm 2013 on Windows and Sourcetree >2.4 I had to escape the arguments and add a full path to the merge options.

在 Windows 和 Sourcetree > 2.4 上使用 PHPStorm 2013 我不得不转义参数并添加到合并选项的完整路径。

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

Jetbras 文档命令行合并

回答by Kristian Ferki?

For the merge-tool on windows, these arguments work for me:

对于 Windows 上的合并工具,这些参数对我有用:

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

回答by Oleg Smolovyk

I recently discovered a more convenient way to use IntelliJ Diff Tool without any settings at all.

我最近发现了一种更方便的使用 IntelliJ Diff Tool 的方法,无需任何设置。

  1. Merge two branches in SourceTree
  2. In IntelliJ IDE (for me its Webstorm) go "VCS->Git->Resolve Conflicts"
  1. 合并 SourceTree 中的两个分支
  2. 在 IntelliJ IDE(对我来说是 Webstorm)中,选择“VCS->Git->Resolve Conflicts”

This way works perfectly.

这种方式非常有效。

enter image description here

在此处输入图片说明

回答by ctreffs

Got IntelliJ to work as SourceTree's diff and merge tool with

让 IntelliJ 用作 SourceTree 的差异和合并工具

  • macOS 10.14.6
  • IntelliJ IDEA 2019.2.1 (Community Edition)
  • SourceTree 3.2.1 (225)
  • macOS 10.14.6
  • IntelliJ IDEA 2019.2.1(社区版)
  • 源树 3.2.1 (225)

using

使用

Diff Command: open
Arguments: -W -b com.jetbrains.intellij.ce --args diff "$LOCAL" "$PWD/$REMOTE"

Diff 命令:open
参数:-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"

合并工具:open
参数:-W -b com.jetbrains.intellij.ce --args merge "$PWD/$LOCAL" "$PWD/$REMOTE" "$PWD/$BASE" "$PWD/$MERGED"

at SourceTree > Preferences > Diff.

SourceTree > Preferences > Diff

See https://i.stack.imgur.com/YEQEV.pngfor a screenshot.

有关屏幕截图,请参阅https://i.stack.imgur.com/YEQEV.png

Hope this helps somebody :-)

希望这对某人有所帮助:-)