Git 历史记录包括/交错子模块提交

发布于 2024-12-26 18:14:43 字数 367 浏览 0 评论 0原文

我想获取存储库和所有子模块的 git log 。手册页说应该使用 git log --submodule ,但这对我不起作用。

------- 编辑 -------

作为示例 - 我运行的内容:

git clone git://git.typo3.org/TYPO3v4/Core.git
cd Core
git submodule init && git submodule update
git log --submodule 

git log --submodule 的输出无论如何都不包含来自任何子模块的提交- 仅子模块指针已更改的提交。

缺少什么?

I'd like to get a git log for the repository and all submodules. The manpage says that git log --submodule should be used but this doesn't work for me.

------- Edit -------

As an example - what I run:

git clone git://git.typo3.org/TYPO3v4/Core.git
cd Core
git submodule init && git submodule update
git log --submodule 

The output of git log --submodule doesn't include the commits from any of the submodules anyhow - just the commits where submodule pointers have been changed.

What's missing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

亚希 2025-01-02 18:14:43

听起来好像您期望 --submodulegit log 输出中将子模块提交与父存储库中的提交交错,但不幸的是,这并不是它的作用。

--submodule 参数定义了子模块差异的显示方式 - 因此,只有使用 git log -p 显示每个更改的补丁时,您才会看到其效果。通常, git log -p 只会显示补丁中子模块更改提交之前和之后的哈希值:

$ git log -1 -p
commit 111808a2bb8c9683d3abe68df419759848ddb16e
Author: Simon Whitaker <simon@...>
Date:   Fri Jan 13 10:40:41 2012 +0000

    Updated ObjectiveFlickr ref

diff --git a/submodules/ObjectiveFlickr b/submodules/ObjectiveFlickr
index b37c053..1bede67 160000
--- a/submodules/ObjectiveFlickr
+++ b/submodules/ObjectiveFlickr
@@ -1 +1 @@
-Subproject commit b37c0539a536147957c01ad01cf2d8666bcbde9e
+Subproject commit 1bede67b8258ed4b95b5d3d6c2175b5e64912269

使用 --submodule 您可以从以下位置获取实际的提交消息列出的子模块:

$ git log -1 -p --submodule
commit 111808a2bb8c9683d3abe68df419759848ddb16e
Author: Simon Whitaker <simon@...>
Date:   Fri Jan 13 10:40:41 2012 +0000

    Updated ObjectiveFlickr ref

Submodule submodules/ObjectiveFlickr b37c053..1bede67:
  > Set SKIP_INSTALL to YES so that Product > Archive 
  still builds app rather than Xcode archive

It sounds as though you're expecting --submodule to interleave submodule commits with those from the parent repository in the git log output, but unfortunately that's not what it does.

The --submodule argument defines how submodule differences are shown - so you'll only see its effects if you're using e.g. git log -p to show patches for each change. Normally, git log -p will just show the hashes for the before and after commits for a submodule change in the patch:

$ git log -1 -p
commit 111808a2bb8c9683d3abe68df419759848ddb16e
Author: Simon Whitaker <simon@...>
Date:   Fri Jan 13 10:40:41 2012 +0000

    Updated ObjectiveFlickr ref

diff --git a/submodules/ObjectiveFlickr b/submodules/ObjectiveFlickr
index b37c053..1bede67 160000
--- a/submodules/ObjectiveFlickr
+++ b/submodules/ObjectiveFlickr
@@ -1 +1 @@
-Subproject commit b37c0539a536147957c01ad01cf2d8666bcbde9e
+Subproject commit 1bede67b8258ed4b95b5d3d6c2175b5e64912269

With --submodule you get the actual commit message from the submodule listed:

$ git log -1 -p --submodule
commit 111808a2bb8c9683d3abe68df419759848ddb16e
Author: Simon Whitaker <simon@...>
Date:   Fri Jan 13 10:40:41 2012 +0000

    Updated ObjectiveFlickr ref

Submodule submodules/ObjectiveFlickr b37c053..1bede67:
  > Set SKIP_INSTALL to YES so that Product > Archive 
  still builds app rather than Xcode archive
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文