包含/交错子模块提交的Git历史记录 [英] Git history including/interleave submodule commits

查看:200
本文介绍了包含/交错子模块提交的Git历史记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望为存储库和所有子模块获取 git log 。该手册说,应该使用 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 

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 输出中父存储库的子模块交付,但不幸的是这不是它的作用。

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.

- 子模块参数定义了子模块差异的显示方式 - 所以只有在使用eg时才能看到其效果 git log -p 显示每个更改的修补程序。通常情况下, git log -p 只会显示修补程序之前和之后提交子模块更改的散列值:

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

这篇关于包含/交错子模块提交的Git历史记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆