在Windows中使用Git difftool以查看除文件差异(万花筒)之外的所有已更改文件的列表? [英] Git difftool in Windows to see list of all changed files in addition to file diffs (a la Kaleidoscope)?

查看:724
本文介绍了在Windows中使用Git difftool以查看除文件差异(万花筒)之外的所有已更改文件的列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我执行 git difftool 时,万花筒显示所有文件在左侧栏中有所变化:

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



Windows中有任何diff-tool会显示这样的内容文件列表?



(我不希望该工具在单独的窗口中同时打开所有文件,我正在寻找一个窗口将显示已更改文件的列表,并且我应该可以单击某个特定文件以查看其差异,如Kaleidoscope屏幕截图所示)

解决方案

 <$ c $ 

c> git difftool --dir-diff




将修改后的文件复制到一个te mb







这个模式在启动diff工具前绝不会提示。

然后,您可以将其与BeyondCompare进行整合



或与WinMerge:

  [diff] 
工具= winmerge
[difftoolwinmerge]
path = C:/ Program Files(x86)/WinMerge/winmergeu.exe
cmd = \C:/ Program Files(x86)/WinMerge/winmergeu.exe\-r -u \ $ LOCAL \\$ REMOTE \

所有这些:

  $ git difftool [< commit> [< commit>]] 






唯一的问题是Windows上的git diff-tool,描述如下:在此博客文章中,通过 nitoyon


在Unix和MacOS上, git difftool --dir-diff 创建一个符号链接如果右侧文件与工作目录中的文件具有相同的SHA1,则为工作目录。使用difftool修改右手文件非常有用。



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


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


以管理员身份运行GitBash,并输入以下命令。



  $ git difftool -d --symlinks [< commit> [< commit>]] 




如果需要,创建一个别名on .gitconfig。




  [别名] 
d = difftool -d --symlinks

但这需要:




     $ b $ li>创建 git mklink 命令: > 
    C:\程序文件(x86)\Git\libexec\git-core\git-mklink:

    #!/ bin / sh

    cmd.exe / cmklink \$ 2 \\$ 1 \> / dev / null




    • 修补msysgit 1.8.3:


      $ b cd / c / Program \ Files \ \(x86 \)/ Git / libexec / git-core /
      $ patch

      使用 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);如果($ symlinks){
      - symlink($ workdir / $ file,$ rdir / $ file)或
      +!system(git ,mklink,$ workdir / $ file,$ rdir / $ file)或
      exit_cleanup($ tmpdir,1);
      } else {
      copy($ workdir / $ file,$ rdir / $ file)或
      @@ -448,7 +448,7 @@
      my $ indices_loaded = 0;

      为我的$文件(@worktree){
      - 接下来如果是$ symlinks&& -l$ b / $ file;
      + next if $ symlinks;
      next if! -f$ b / $ file;

      if(!$ indices_loaded){


      When I do a git difftool, Kaleidoscope shows me all the files that have changed in the left sidebar:

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

      Is there any diff-tool in Windows that would show me such a list of files?

      (I don't want the tool to open all the files at the same time in separate windows. I'm looking for a single window that will show me the list of files changed, and I should be able to click on a particular file to see its diff, as shown in the Kaleidoscope screenshot)

      解决方案

      You can use git difftool in a way which lists all the files (git1.8+ recommended):

      git difftool --dir-diff
      

      Copy the modified files to a temporary location and perform a directory diff on them.
      This mode never prompts before launching the diff tool.

      You can then integrate it with a BeyondCompare for instance.

      Or with 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\"
      

      All that with:

          $ git difftool [<commit> [<commit>]]
      


      The only problem is the git diff-tool, on Windows, is described in this blog post, by nitoyon.

      On Unix and MacOS, git difftool --dir-diff create a symbolic link to the working directory if a right-hand file has the same SHA1 as the file in the working directory. It's very useful when we modify right-hand files with a difftool.

      On Windows, instead of creating symbolic links, git difftool --dir-diff copy back right-hand files to working directory after difftool program exits. I want to use symlinks on Git for Windows like Unix and MacOS.

      Note: On Windows, administrator privileges is required to create symbolic links.

      Run GitBash as an administrator, and enter following command.

      $ git difftool -d --symlinks [<commit> [<commit>]]
      

      If you want, create an alias on .gitconfig.

      [alias]
          d = difftool -d --symlinks
      

      But that requires:

      • to create a git mklink command:

      C:\Program Files (x86)\Git\libexec\git-core\git-mklink:
      
      #!/bin/sh
      
      cmd.exe /c "mklink \"$2\" \"$1\"" > /dev/null
      

      • to patch 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) {

      这篇关于在Windows中使用Git difftool以查看除文件差异(万花筒)之外的所有已更改文件的列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆