分支或提交的Git diff在可视difftool中显示文件列表概述,然后可选择单个文件diff [英] Git diff of branches or commits showing file list overview in visual difftool and then selectable single file diff

查看:270
本文介绍了分支或提交的Git diff在可视difftool中显示文件列表概述,然后可选择单个文件diff的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

tl; dr::如何获取自定义difftool来打开分支的目录/文件视图或提交diff,以便可以在单个文件diff中跳入difftool并返回目录列表以选择下一个文件对?使用git和Beyond Compare4.(从文件列表到文件diff来回跳转是difftools功能的一部分).

tl;dr: How can I get my custom difftool to open a directory/file view of a branch or commit diff so I can jump inside of my difftool in single file diffs and back to directory list to select the next pair of files? Using git and Beyond Compare 4. (Jumping back and forth from file list to file diff and back is partly a build in feature of the difftools).

详细信息:
在过去的几个月中,我一直在致力于Git,这是一个很好的工具.但是我想知道是否有可能解决我在git主题上进行互联网搜索时未找到的功能.用脚本编写类似行为也可以.但是也许是内置的,还是有人已经解决了这个问题?

Details:
I have been working myself into Git the last couple of month and it is a great tool. But I was wondering if there is a possibility to solve a feature I haven't found during my internet searches on git topics. Scripting something to get a similar behavior would also be fine. But maybe it is build-in or someone solved the problem already?

我要做什么?
从我以前的工作环境中,我可以选择查看2个签到(提交)的差异.它在我的自定义差异工具中打开了一个文件/目录差异列表,我并排看到了所有文件.在一侧提交(或分支)第一个,在另一侧提交(或分支)第二.我可以选择一个文件对,查看两个文件的差异,并在完成后跳回到目录/文件列表(自定义difftool功能).

What am I trying to do?
From my former work environment I had the possibility to select to see a diff of 2 checkins (commits). It opened a file/directory diff list in my custom diff tool and I saw all files side by side. On one side commit (or branch) No. one an on the other side commit (or branch) No. two. I could select a file pair and see a diff of the 2 files and jump back into the directory/file list (custom difftool feature) when finished.

我的git在做什么?
目前,如果我做一个涉及

What is my git doing?
Currently if I do a diff involving several files like

git difftool branch1..branch2

git bash将一个文件打开到另一个文件.分别要求每个人.如果有很多文件,并且如果我不确定我想先看一下还是只想获得概述,这有点麻烦.而且我特别希望在我的difftool中看到它.

the git bash opens one file after the other. Asking for each one separately. This is a bit ackward if there are many files and in case I am not sure what I want to look at beforehand or if I just want to get an overview. And I would especially prefer to see it in my difftool.

Ann:更复杂的功能是能够看到3个文件的差异,包括文件的共同祖先(但不在文件/目录视图中).

Ann.: A more sofisticated feature would be to be able to see a 3 file diff including the common ancestor of the file (but not in the file/directory view).

信息:
我在Windows平台上,因此,如果您了解linux解决方案或进行了设置,请给我一些有关所涉及的linux内部构件的信息.
我使用的工具可能已经具有秘密"功能了吗?它们是Visual Studio 2013和Sourcetree,另外还有命令行git bash.
如果相关的话:我使用的difftools超越了Compare 4和Sourcegear DiffMerge.

Infos:
I am on a windows platform so if you know of a linux solution or have one set up please give me some info on involved linux internals.
Possibly the tools I am using have a "secret" feature already? They are Visual Studio 2013 and Sourcetree additionally to command line git bash.
if relevant: The difftools I am using are Beyond Compare 4 and Sourcegear DiffMerge.

推荐答案

我不知道我一直在看什么.当我做一些比较时,我偶然发现了该解决方案,然后重新阅读了git diff-tool的帮助页面以记住一个参数.通常我只阅读git diff帮助页面,因为它们共享相同的参数.

I don't know what I was looking at all the time. I just stumbled upon the solution when I did some diffs and reread the help page for git diff-tool to remember a parameter. Usually I only read git diff help page because they share the same parameters.

在那里,我看到了参数-d并进行了尝试.
具有文件夹和文件的2向差异的解决方案是以下命令:

There I saw the parameter -d and gave it a try.
The solution for a 2-way diff with folders and files is the command:

git difftool -d branch1 branch2
git difftool --dir-diff branch1 branch2

git difftool -d commit1 commit2

然后,Beyond Compare在目录diff模式下打开,我可以看到分支或提交之间的差异.
虽然您只能看到更改的文件,但不包括未更改的文件.但这并不是真正的缺点.

then Beyond Compare opens in directory diff mode and I can see the differences between the branches or commit.
Although you can only see the changed files not including the unchanged. But it is not really a drawback.

git-difftool 的帮助文件中,它说:

In the help file at git-difftool it says:

-d
--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.

这篇关于分支或提交的Git diff在可视difftool中显示文件列表概述,然后可选择单个文件diff的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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