【问题标题】:Use VS Code as git diff tool使用 VS Code 作为 git diff 工具
【发布时间】:2020-08-25 16:43:20
【问题描述】:

VS 代码 有很好的内置功能来diff 两个文件。

是否可以使用 vs code diff 作为 git 的 diff 工具?

【问题讨论】:

    标签: git visual-studio-code diff vscode-settings


    【解决方案1】:

    就像Maciej 所说,gitconfig 是要走的路。有了这个,我可以将它设置为不仅仅是一个 difftool,而且是 git 的合并工具。

    [diff]
        tool = vscode
    [merge]
        tool = vscode
    [difftool "vscode"]
        cmd = code --wait --diff $LOCAL $REMOTE
    [mergetool "vscode"]
        cmd = code --wait $MERGED
    

    我使用 VSCode Insiders,提前获得最新(但仍然稳定)的功能

    [diff]
        tool = vscode
    [merge]
        tool = vscode
    [difftool "vscode"]
        cmd = code-insiders --wait --diff $LOCAL $REMOTE
    [mergetool "vscode"]
        cmd = code-insiders --wait $MERGED
    

    【讨论】:

      【解决方案2】:

      是的,有可能 您只需将 Visual Studio Code 设置为您的默认 difftool,方法是将其添加到您的 ~/.gitconfig 文件中。

      [diff]
          tool = vscode
      [difftool "vscode"]
          cmd = code --wait --diff $LOCAL $REMOTE
      

      此操作后,只需运行命令,例如:git difftool master,几秒钟后 VS Code 运行 difftool

      【讨论】:

        猜你喜欢
        • 2015-11-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-01-15
        • 2016-02-20
        • 1970-01-01
        • 2015-07-31
        • 1970-01-01
        相关资源
        最近更新 更多