Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git 如何显示部分或所有文件之间的差异?吉特_Git - Fatal编程技术网

Git 如何显示部分或所有文件之间的差异?吉特

Git 如何显示部分或所有文件之间的差异?吉特,git,Git,如主题:如何显示部分或所有文件之间的差异 对不起,我把问题搞砸了。我指的是一个或多个或所有文件的分支之间的差异 git diff 将显示未提交文件的挂起修改更改 通过此命令,您可以通过多种不同的方式查看文件之间的差异您的问题很有价值,但我认为您正在寻找: git diff 或者更有用一点: git diff <commit1> <commit2> -- path/to/file.cpp path/to/anotherfile.cpp path/to/subdir 现

如主题:如何显示部分或所有文件之间的差异

对不起,我把问题搞砸了。我指的是一个或多个或所有文件的分支之间的差异

git diff
将显示未提交文件的挂起修改更改


通过此命令,您可以通过多种不同的方式查看文件之间的差异

您的问题很有价值,但我认为您正在寻找:

git diff

或者更有用一点:

git diff <commit1> <commit2> -- path/to/file.cpp path/to/anotherfile.cpp path/to/subdir

现在你通常不会这样做,除非你的回购协议中有“同一”文件的多个版本(如果你问我,这是不确定的)。

或git diff最好的一个是第三个:
git diff:path/to/file.cpp:path/to/anotherfile.cpp
git diff {<commit1>,<commit2>}:path/to/file.cpp
git diff <commit1>:path/to/file.cpp <commit2>:path/to/anotherfile.cpp
$ git ls-tree HEAD^ | grep blob | sort -R | head -2
100644 blob 27785581e788049ac805fab1d75744dd7379735d    .gitignore
100644 blob 2821a5271ffd8e6b11bb26b8571f57e88ab81f38    TESTING

$ git diff --stat 2821a5271ffd8e6b11bb26b8571f57e88ab81f38 aa96765714a3058068c4425d801fab4b64e26066
 ...f38 => aa96765714a3058068c4425d801fab4b64e26066 |  155 +++++++++++++++++---
 1 files changed, 135 insertions(+), 20 deletions(-)