用VsCode作为Git的difftool和mergetool一次性打开所有文件。

问题描述 投票:1回答:1

目前,我将VsCode配置为我的 git difftoolgit mergetool

我的 ~\.gitconfig 文件看起来是这样的。

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

但是,当我运行 git difftool,它会问我

Viewing (1/6): 'Repo\directory\someCode.cs'                                                                                                                 
Launch 'vscode' [Y/n]?

有没有办法一次性打开所有的差异文件?能在不关闭文件的情况下循环使用是很有用的,目前我把VsCode配置成git difftool和git mergetool。

windows git visual-studio-code git-config git-difftool
1个回答
0
投票

我发现的简单方法是。

  1. 为位于home.bashrc(DebianUbuntu发行版)的.bashrc文件添加一个别名。
  2. 在最后添加以下一行 alias difftool="git difftool -y"并保存它。
  3. 用以下命令重新加载bash source ~/.bashrc终端上的。
  4. 尝试再次运行它。
© www.soinside.com 2019 - 2024. All rights reserved.