Visual Studio Code for Mac 作为 Sourcetree 中的差异/合并工具

ozz*_*tto 9 git macos atlassian-sourcetree visual-studio-code

有没有办法可以将 Visual Studio Code 设置为 Mac 上 Sourcetree 中的默认差异/合并工具?

Swa*_*nil 10

您需要在 Sourcetree 中进行以下配置

  • 去 Sourcetree 吗?偏好差异
  • 在部分External Diff / Merge 中,为Visual Diff ToolMerge Tool选择Custom
  • 差异参数 ? --diff --wait "$LOCAL" "$REMOTE"

  • 合并参数 ?-n --wait "$MERGED"

  • 保存配置后,转到 Sourcetree 并右键单击具有合并冲突的文件解决冲突? 启动外部合并工具

注意:DiffMerge命令应该指向/usr/local/bin/code而不是,code否则它将不起作用

Sourcetree 外部差异/合并工具配置 解决源树中冲突的步骤

  • 可能还需要将“代码”添加到您的路径https://code.visualstudio.com/docs/setup/mac#_launching-from-the-command-line (4认同)

JDB*_*JDB 5

根据我找到文档,Sourcetree 只使用您配置的 Git 存储库使用的任何内容。

您可以通过如下git config命令配置您的 Git 存储库以使用 Visual Studio Code :

git config --global core.editor "code --wait"
Run Code Online (Sandbox Code Playgroud)

但是,您必须将 Visual Studio Code 配置为从终端启动,然后才能工作。

有关更多信息,请参阅此博客文章


bcr*_*bcr 5

我找到了这个,里面有关于如何让它在 Mac 上运行的说明。直到我使用代码可执行文件的完整路径(我还在全局路径中设置了代码),我才能够让它工作

/usr/local/bin/code
Run Code Online (Sandbox Code Playgroud)