简体   繁体   English

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

[英]Git history including/interleave submodule commits

I'd like to get a git log for the repository and all submodules. 我想获取存储库和所有子模块的git log The manpage says that git log --submodule should be used but this doesn't work for me. 联机帮助页上说应该使用git log --submodule但这对我不起作用。

------- 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. git log --submodule的输出git log --submodule都不包含任何子模块的提交,仅包括子模块指针已更改的提交。

What's missing? 少了什么东西?

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. 听起来好像您期望--submodule将子模块的提交与git log输出中的父存储库中的提交进行交织,但是不幸的是,它不是这样做的。

The --submodule argument defines how submodule differences are shown - so you'll only see its effects if you're using eg git log -p to show patches for each change. --submodule参数定义了子模块差异的显示方式-因此,仅当您使用git log -p显示每次更改的补丁时,您才会看到其效果。 Normally, git log -p will just show the hashes for the before and after commits for a submodule change in the patch: 通常, 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

With --submodule you get the actual commit message from the submodule listed: 使用--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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM