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早于2.31,您仍然需要-m标志(当使用Git log时,也就是说,Git show默认为--cc,因此不需要-m,并且所有这些都在Git 2.31中得到了清理)。_Git_Merge_Show - Fatal编程技术网

您的Git早于2.31,您仍然需要-m标志(当使用Git log时,也就是说,Git show默认为--cc,因此不需要-m,并且所有这些都在Git 2.31中得到了清理)。

您的Git早于2.31,您仍然需要-m标志(当使用Git log时,也就是说,Git show默认为--cc,因此不需要-m,并且所有这些都在Git 2.31中得到了清理)。,git,merge,show,Git,Merge,Show,因为这些解决方案涉及到显示组合的差异,例如: git diff --cc $M $M^1 $M^2 $(git merge-base $M^1 $M^2) 但是:“diff--cc”的输出在 涉及合并的重命名 Git2.22(2019年第1季度)中的一个新选项将原始树中的路径添加到输出中 git diff --cc --combined-all-paths $M $M^1 $M^2 $(git merge-base $M^1 $M^2) 日志,差异树:添加--组合所有路径选项 合并的组合差异

因为这些解决方案涉及到显示组合的差异,例如:

git diff --cc $M $M^1 $M^2 $(git merge-base $M^1 $M^2)
但是:“
diff--cc
”的输出在 涉及合并的重命名
Git2.22(2019年第1季度)中的一个新选项将原始树中的路径添加到输出中

git diff --cc --combined-all-paths $M $M^1 $M^2 $(git merge-base $M^1 $M^2)
日志
差异树
:添加
--组合所有路径
选项 合并的组合差异格式将只列出一个文件名,即使 重命名或复制检测处于活动状态

例如,对于原始格式,您可能会看到:

::100644 100644 100644 fabadb8 cc95eb0 4866510 MM describe.c
::100755 100755 100755 52b7a2d 6d1ac04 d2ac7d7 RM   bar.sh
::100644 100644 100644 e07d6c5 9042e82 ee91881 RR   phooey.c
这并没有让我们知道
bar.sh
的原始名称 第一个家长,不让我们知道他们的名字 所有的
phooey.c
都在父母中

相反,对于非合并提交,原始格式确实提供原始文件名(以及要引导的重命名分数)。
为了还为合并提交提供原始文件名,请添加一个
--combined all path
选项(该选项必须与
-c
--cc
一起使用,并且可能仅在重命名或复制检测处于活动状态时有用),以便我们可以在 涉及重命名

这会将上述输出转换为:

::100644 100644 100644 fabadb8 cc95eb0 4866510 MM desc.c  desc.c  desc.c
::100755 100755 100755 52b7a2d 6d1ac04 d2ac7d7 RM   foo.sh  bar.sh  bar.sh
::100644 100644 100644 e07d6c5 9042e82 ee91881 RR   fooey.c fuey.c  phooey.c
此外,在补丁格式中,这会更改from/to标头,这样我们就可以为每个父级获得一个“from”标头,而不是一个“from” 比如说,没有

--- a/phooey.c
+++ b/phooey.c
我们会看到

--- a/fooey.c
--- a/fuey.c
+++ b/phooey.c

git show-c c0f501
将显示一个从提交
c0f501
到它的两个父级,如合并期间由
git diff
打印的

这比gitshow-m提供了更好的概述

但是,它仅显示相对于双亲(或对于八达通合并,至少两个双亲)更改的文件中的更改。例如,当在第一个父级上更改文件
f1
f2
,在第二个父级上更改文件
f2
f3
时,此命令仅显示来自
f2
的更改。将不显示
f1
f3
中的更改。 因此,要获得完整的概述,在使用
gitshow-c
之前或之后使用
gitshow-m
仍然是有意义的

八达通合并的
git show-c
输出示例,其中更改了两个文件,其中只有一个文件为多个父文件更改:

commit 3a9f99582921495f7c25e682d4af36d3407983f9 (HEAD -> master)
Merge: 33fb507 91c772b edf2d9c
Author: Foo Bar <foobar@example.net>
Date:   Mon Mar 22 15:56:37 2021 +0100

    Merge branches 'b1' and 'b2'

diff --combined b
index 4658c0c,a305e3c,2788b76..9c7beb1
--- a/b
+++ b/b
@@@@ -1,5 -1,5 -1,5 +1,7 @@@@
   1
   2
+ +a
   3
 ++b
   4
++ c

谢谢,帮助很多人找到了一个在解决冲突中丢失的方法。我认为,
gitshow-mc05f017
是最有用的。使用git show-m-p--stat c05f017将添加更改文件的列表。如果跳过
-p
,您将只获得文件列表。谢谢
git show HEAD ^2
很有帮助,解释后很容易记住。令人遗憾的是,
git show——第一代家长做了同样的事情……@remcycles:在你发表评论大约2年后,有人提议为git 2.29解决这个问题(我想)。可能是
--- a/fooey.c
--- a/fuey.c
+++ b/phooey.c
commit 3a9f99582921495f7c25e682d4af36d3407983f9 (HEAD -> master)
Merge: 33fb507 91c772b edf2d9c
Author: Foo Bar <foobar@example.net>
Date:   Mon Mar 22 15:56:37 2021 +0100

    Merge branches 'b1' and 'b2'

diff --combined b
index 4658c0c,a305e3c,2788b76..9c7beb1
--- a/b
+++ b/b
@@@@ -1,5 -1,5 -1,5 +1,7 @@@@
   1
   2
+ +a
   3
 ++b
   4
++ c
git show -m 3a9f99582921495f7c25e682d4af36d3407983f9
commit 3a9f99582921495f7c25e682d4af36d3407983f9 (from 33fb5076fbbcc2d82aa0b877c959b8e4cc4f7b74)
Merge: 33fb507 91c772b edf2d9c
Author: Foo Bar <foobar@example.net>
Date:   Mon Mar 22 15:56:37 2021 +0100

    Merge branches 'b1' and 'b2'

diff --git a/a b/a
index 94ebaf9..775aea6 100644
--- a/a
+++ b/a
@@ -1,4 +1,5 @@
 1
+a
 2
 3
 4
diff --git a/b b/b
index 4658c0c..9c7beb1 100644
--- a/b
+++ b/b
@@ -1,5 +1,7 @@
 1
 2
+a
 3
 b
 4
+c

commit 3a9f99582921495f7c25e682d4af36d3407983f9 (from 91c772b2c57ff9b4791b57712c26aefbd0c7e730)
Merge: 33fb507 91c772b edf2d9c
Author: Foo Bar <foobar@example.net>
Date:   Mon Mar 22 15:56:37 2021 +0100

    Merge branches 'b1' and 'b2'

diff --git a/b b/b
index a305e3c..9c7beb1 100644
--- a/b
+++ b/b
@@ -2,4 +2,6 @@
 2
 a
 3
+b
 4
+c

commit 3a9f99582921495f7c25e682d4af36d3407983f9 (from edf2d9c9a255a709875988278a4eda6f7072196e)
Merge: 33fb507 91c772b edf2d9c
Author: Foo Bar <foobar@example.net>
Date:   Mon Mar 22 15:56:37 2021 +0100

    Merge branches 'b1' and 'b2'

diff --git a/a b/a
index 94ebaf9..775aea6 100644
--- a/a
+++ b/a
@@ -1,4 +1,5 @@
 1
+a
 2
 3
 4
diff --git a/b b/b
index 2788b76..9c7beb1 100644
--- a/b
+++ b/b
@@ -1,5 +1,7 @@
 1
 2
+a
 3
+b
 4
 c