git difftool,立即打开所有diff文件,而不是串行 [英] git difftool, open all diff files immediately, not in serial

查看:735
本文介绍了git difftool,立即打开所有diff文件,而不是串行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认的git diff行为是以串行方式打开每个diff文件(等待先前的文件在打开下一个文件之前关闭)。

我正在寻找一种方法来一次打开所有文件 - 例如,在BeyondCompare中,这将在同一个BC窗口中打开所有标签中的文件。 p>

这样可以更轻松地查看一组复杂的变化;在diff文件之间来回切换并忽略不重要的文件。

解决方案

这就是我所解决的问题......



将以下代码复制到名为 git-diffall (无扩展名)的文件中:

 #!/ bin / sh 
git diff --name-only$ @|同时读取文件名;做
git difftool$ @ - 无提示$ filename&
完成

将文件放入 cmd git install dir文件夹(例如 C:\程序文件(x86)\Git\cmd



像你一样使用 git diff

  git diffall 
git diffall HEAD
git diffall --cached
git diffall rev1..rev2
etc ...

注意:它的关键是& 参数,它告诉外部diff命令在后台任务中运行,以便立即处理文件。在BeyondCompare的情况下,它会在每个文件的标签页中打开一个屏幕。


The default git diff behavior is to open each diff file in serial (wait for previous file to be closed before opening next file).

I'm looking for a way to open all the files at once - in BeyondCompare for example this would open all the files in tabs within the same BC window.

This would make it easier to review a complex set of changes; flick back and forwards between the diff files and ignore unimportant files.

解决方案

Here's what I settled on...

Copy the following code to a file called git-diffall (no extension):

#!/bin/sh
git diff --name-only "$@" | while read filename; do
    git difftool "$@" --no-prompt "$filename" &
done

Place the file in the cmd folder of your git install dir (eg C:\Program Files (x86)\Git\cmd)

And use like you would git diff:

git diffall
git diffall HEAD
git diffall --cached 
git diffall rev1..rev2
etc...

Notes: The key to it is the & param which tells the external diff command to run in a background task so files are processed immediately. In the case of BeyondCompare this opens one screen with each file in its own tab.

这篇关于git difftool,立即打开所有diff文件,而不是串行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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