gpt4 book ai didi

git difftool,立即打开所有差异文件,而不是串行

转载 作者:IT王子 更新时间:2023-10-29 01:14:40 27 4
gpt4 key购买 nike

默认的 git diff 行为是依次打开每个 diff 文件(在打开下一个文件之前等待上一个文件关闭)。

我正在寻找一种同时打开所有文件的方法 - 例如,在 BeyondCompare 中,这将在同一 BC 窗口的选项卡中打开所有文件。

这将使审查一组复杂的更改变得更加容易;在 diff 文件之间来回切换并忽略不重要的文件。

最佳答案

git 开头v1.7.11,可以使用 git difftool --dir-diff 执行目录差异。

例如,此功能适用于 Meld 3.14.2,并允许您浏览所有修改过的文件:

git difftool --dir-diff --tool=meld HEAD~ HEAD

这是一个方便的 Bash 函数:

git-diff-meld() (
git difftool --dir-diff --tool=meld "${1:-HEAD~}" "${2:-HEAD}"
)

以下答案适用于 git安装早于 v1.7.11。


同样的问题在 git mail list 上被问到.

我根据该电子邮件线程整理了一个 shell 脚本,该脚本在任意提交之间执行目录差异。

从 git v1.7.10 开始,git-diffall脚本包含在 contrib 中标准的 git 安装。

对于 v1.7.10 之前的版本,您可以从 git-diffall 安装项目 GitHub .

这是项目描述:

The git-diffall script provides a directory based diff mechanism for git. The script relies on the diff.tool configuration option to determine what diff viewer is used.

This script is compatible with all the forms used to specify a range of revisions to diff:

1) git diffall: shows diff between working tree and staged changes
2) git diffall --cached [<commit>]: shows diff between staged changes and HEAD (or other named commit)
3) git diffall <commit>: shows diff between working tree and named commit
4) git diffall <commit> <commit>: show diff between two named commits
5) git diffall <commit>..<commit>: same as above
6) git diffall <commit>...<commit>: show the changes on the branch containing and up to the second , starting at a common ancestor of both <commit>

Note: all forms take an optional path limiter [--] [<path>]

This script is based on an example provided by Thomas Rast on the Git list.

关于git difftool,立即打开所有差异文件,而不是串行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1220309/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com