在Windows中使用Git difftool查看除文件差异(万花筒)之外的所有已更改文件的列表?

Pla*_*mer 12 git diff kaleidoscope

当我这样做时git difftool,Kaleidoscope会向我显示左侧边栏中已更改的所有文件:

http://www.kaleidoscopeapp.com/static/img/screenshots/Changeset_Blocks.png

Windows中是否有任何diff工具可以显示这样的文件列表?

(我不希望该工具在单独的窗口中同时打开所有文件.我正在寻找一个窗口,它会显示已更改的文件列表,我应该可以单击特定文件看看它的差异,如万花筒截图所示)

Von*_*onC 11

您可以以列出所有文件的方式使用git difftool(git1.8 +推荐):

git difftool --dir-diff
Run Code Online (Sandbox Code Playgroud)

将修改后的文件复制到临时位置并对其执行目录差异.
此模式在启动diff工具之前从不提示.

然后,您可以将其与BeyondCompare集成.

或者使用WinMerge:

[diff]
    tool = winmerge
[difftool "winmerge"]
    path = C:/Program Files (x86)/WinMerge/winmergeu.exe
    cmd = \"C:/Program Files (x86)/WinMerge/winmergeu.exe\" -r -u \"$LOCAL\" \"$REMOTE\"
Run Code Online (Sandbox Code Playgroud)

所有这一切:

    $ git difftool [<commit> [<commit>]]
Run Code Online (Sandbox Code Playgroud)

唯一的问题是在Windows上的git diff-tool 在本博文中nitoyon描述.

在Unix和MacOS上,git difftool --dir-diff如果右侧文件与工作目录中的文件具有相同的SHA1 ,则创建指向工作目录的符号链接.当我们使用difftool修改右侧文件时,它非常有用.

在Windows上,不是创建符号链接,而是git difftool --dir-diffdifftool程序退出后将右侧文件复制回工作目录.我想在Unix和MacOS等Git for Windows上使用符号链接.

注意:在Windows上,创建符号链接需要管理员权限.

以管理员身份运行GitBash,然后输入以下命令.

$ git difftool -d --symlinks [<commit> [<commit>]]
Run Code Online (Sandbox Code Playgroud)

如果需要,请在.gitconfig上创建别名.

[alias]
    d = difftool -d --symlinks
Run Code Online (Sandbox Code Playgroud)

但这需要:

  • 创建git mklink命令:
C:\Program Files (x86)\Git\libexec\git-core\git-mklink:

#!/bin/sh

cmd.exe /c "mklink \"$2\" \"$1\"" > /dev/null
  • 修补msysgit 1.8.3:
cd /c/Program\ Files\ \(x86\)/Git/libexec/git-core/
$ patch 

With git-difftool.patch:

--- git-difftool Sun Jun 2 11:28:06 2013 +++ git-difftool Tue Jul 9 00:42:02 2013 @@ -283,7 +283,7 @@ exit_cleanup($tmpdir, 1); } if ($symlinks) { - symlink("$workdir/$file", "$rdir/$file") or + !system("git", "mklink", "$workdir/$file", "$rdir/$file") or exit_cleanup($tmpdir, 1); } else { copy("$workdir/$file", "$rdir/$file") or @@ -448,7 +448,7 @@ my $indices_loaded = 0; for my $file (@worktree) { - next if $symlinks && -l "$b/$file"; + next if $symlinks; next if ! -f "$b/$file"; if (!$indices_loaded) {
Run Code Online (Sandbox Code Playgroud)