Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.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_Github - Fatal编程技术网

git中非相邻提交中同一文件的两个版本之间的差异

git中非相邻提交中同一文件的两个版本之间的差异,git,github,Git,Github,假设我有一个包含一些提交的存储库: latest-commit before-latest-commit ... some-old-commit 假设它有一个名为1.file 假设在各种提交中都是这样: 一些旧的承诺: a=1; 在最新提交之前: a=1; b=2; c=3; a=1; c=3; 最新提交: a=1; b=2; c=3; a=1; c=3; 我是否可以查看最新提交和一些旧提交版本的1.file(最好在github上)之间的差异,并使用行c=3被标记为新的,而与b有关的

假设我有一个包含一些提交的存储库:

latest-commit
before-latest-commit
...
some-old-commit
假设它有一个名为
1.file

假设在各种提交中都是这样:

一些旧的承诺:

a=1;
在最新提交之前:

a=1;
b=2;
c=3;
a=1;
c=3;
最新提交:

a=1;
b=2;
c=3;
a=1;
c=3;
我是否可以查看
最新提交
一些旧提交
版本的
1.file
(最好在github上)之间的差异,并使用行
c=3被标记为新的,而与b有关的内容将被忽略(因为它是不相关的)

这似乎是一些基本的东西,但我未能达到预期的效果。

使用:

git diff some-old-commit..latest-commit -- 1.file

您将无法在github上运行此操作,因此首先从本地存储库中的github获取。

如果
最新提交
确实是最新提交,并且工作树中没有任何更改,则可以将其缩短如下:
git diff some old commit 1.file