gpt4 book ai didi

git - 为什么这个 merge 提交没有显示差异?

转载 作者:行者123 更新时间:2023-12-04 08:56:19 25 4
gpt4 key购买 nike

在一个分支中,我添加了一行文本。在另一个分支中,我修改了一些行。然后我将它们 merge 在一起,在修复 merge 冲突时,只保留来自第二个分支的更改。我的问题是:为什么删除 16fcbc7 中添加的行没有出现在 merge 提交的差异中?
这是 git log --oneline --graph -p 的输出. (空)差异与 git show 584d05b 显示的相同.

*   584d05b (HEAD, origin/capitalize-lenore) Merge branch 'master' into capitalize-lenore
|\
| * 16fcbc7 (origin/master) Improve the poem
| | diff --git a/the-raven.txt b/the-raven.txt
| | index adcd9a1..a74559b 100644
| | --- a/the-raven.txt
| | +++ b/the-raven.txt
| | @@ -29,6 +29,7 @@ Darkness there, and nothing more.
| | Deep into that darkness peering, long I stood there wondering, fearing,
| | Doubting, dreaming dreams no mortal ever dared to dream before;
| | But the silence was unbroken, and the darkness gave no token,
| | +and it all was left unspoken, in the vastness of the ocean,
| | And the only word there spoken was the whispered word, "Lenore!"
| | This I whispered, and an echo murmured back the word, "Lenore!"
| | Merely this and nothing more.
* | 6c0160b Capitalize LENORE
|/
| diff --git a/the-raven.txt b/the-raven.txt
| index adcd9a1..a9f39d6 100644
| --- a/the-raven.txt
| +++ b/the-raven.txt
| @@ -8,8 +8,8 @@ Only this, and nothing more."
| Ah, distinctly I remember it was in the bleak December,
| And each separate dying ember wrought its ghost upon the floor.
| Eagerly I wished the morrow:—vainly I had sought to borrow
| -From my books surcease of sorrow—sorrow for the lost Lenore—
| -For the rare and radiant maiden whom the angels name Lenore—
| +From my books surcease of sorrow—sorrow for the lost LENORE—
| +For the rare and radiant maiden whom the angels name LENORE—
| Nameless here for evermore.
|
| And the silken sad uncertain rustling of each purple curtain
| @@ -29,8 +29,8 @@ Darkness there, and nothing more.
| Deep into that darkness peering, long I stood there wondering, fearing,
| Doubting, dreaming dreams no mortal ever dared to dream before;
| But the silence was unbroken, and the darkness gave no token,
| -And the only word there spoken was the whispered word, "Lenore!"
| -This I whispered, and an echo murmured back the word, "Lenore!"
| +And the only word there spoken was the whispered word, "LENORE!"
| +This I whispered, and an echo murmured back the word, "LENORE!"
| Merely this and nothing more.
|
| Back into the chamber turning, all my soul within me burning,
| @@ -92,8 +92,8 @@ She shall press, ah, nevermore!
| Then, methought, the air grew denser, perfumed from an unseen censer
| Swung by seraphim whose foot-falls tinkled on the tufted floor.
| "Wretch," I cried, "thy God hath lent thee—by these angels he hath sent thee
| -Respite—respite and nepenthe from thy memories of Lenore!
| -Quaff, oh quaff this kind nepenthe, and forget this lost Lenore!"
| +Respite—respite and nepenthe from thy memories of LENORE!
| +Quaff, oh quaff this kind nepenthe, and forget this lost LENORE!"
| Quoth the Raven, "Nevermore."
|
| "Prophet!" said I, "thing of evil!—prophet still, if bird or devil!—
| @@ -106,8 +106,8 @@ Quoth the Raven, "Nevermore."
| "Prophet!" said I, "thing of evil—prophet still, if bird or devil!
| By that Heaven that bends above, us—by that God we both adore—
| Tell this soul with sorrow laden if, within the distant Aidenn,
| -It shall clasp a sainted maiden whom the angels name Lenore—
| -Clasp a rare and radiant maiden whom the angels name Lenore."
| +It shall clasp a sainted maiden whom the angels name LENORE—
| +Clasp a rare and radiant maiden whom the angels name LENORE."
| Quoth the Raven, "Nevermore."
|
| "Be that word our sign of parting, bird or fiend!" I shrieked, upstarting—
* 3c0e072 Add newlines
.
.
.
这个问题指的是 this repository 中的提交.

最佳答案

默认:git log -p不显示任何类型的 merge 提交差异。
您可以添加选项来修改它:

  • --cc获取组合差异格式
  • -m获取完整的差异格式

  • 或者明确地检查其父级中的任何一个的差异:
    git diff HEAD^ HEAD  # you will see the differences brought in by the second parent
    git diff HEAD^2 HEAD # you will see the differences brought in by the first parent

    关于git - 为什么这个 merge 提交没有显示差异?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63814849/

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