Git 日志不显示子模块更改

发布于 2025-01-08 02:51:34 字数 1072 浏览 0 评论 0原文

我在 master 上有一个提交,哈希值 6877146,它更新了一个子模块。

$ git show 6877146
commit 6877146f1781bfbd4ec3ae2a27121a606f5f688e
Author: [snip]
Date:   Wed Feb 22 16:10:20 2012 +0000

    updating potatobase

diff --git a/potatobase b/potatobase
index 5877e2c..b77ba62 160000
--- a/potatobase
+++ b/potatobase
@@ -1 +1 @@
-Subproject commit 5877e2c2d82645fa44f121884291ee48cf24584d
+Subproject commit b77ba624d6a1c5e62d434ad2d06383604aeab431

此提交位于主分支上,我当前已签出:

$ git branch -a --contains 6877146
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
  remotes/origin/ticket-1479-refactor-blade-json-functions

但是,在子模块上执行 git log 不会显示该提交:

$ git log potatobase | grep 6877146
$

如果我显式签出此提交,它会在日志中:

$ git checkout 6877146
$ git log potatobase | grep 6877146
commit 6877146f1781bfbd4ec3ae2a27121a606f5f688e

为什么此提交未显示在当我签出master时记录?它已经合并到 master 中:

$ git checkout master
$ git merge 6877146
Already up-to-date.
$

I have a commit on master, hash 6877146, which updates a submodule.

$ git show 6877146
commit 6877146f1781bfbd4ec3ae2a27121a606f5f688e
Author: [snip]
Date:   Wed Feb 22 16:10:20 2012 +0000

    updating potatobase

diff --git a/potatobase b/potatobase
index 5877e2c..b77ba62 160000
--- a/potatobase
+++ b/potatobase
@@ -1 +1 @@
-Subproject commit 5877e2c2d82645fa44f121884291ee48cf24584d
+Subproject commit b77ba624d6a1c5e62d434ad2d06383604aeab431

This commit is on the master branch, which I currently have checked out:

$ git branch -a --contains 6877146
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
  remotes/origin/ticket-1479-refactor-blade-json-functions

However, doing git log on the submodule does not show the commit:

$ git log potatobase | grep 6877146
$

If I explicitly check out this commit, it's in the log:

$ git checkout 6877146
$ git log potatobase | grep 6877146
commit 6877146f1781bfbd4ec3ae2a27121a606f5f688e

Why is this commit not shown in the log when I've checked out master? It's already merged into master:

$ git checkout master
$ git merge 6877146
Already up-to-date.
$

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

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

发布评论

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

评论(1

徒留西风 2025-01-15 02:51:34

更新子模块的提交只会更改 git 在初始化/更新子模块时签出的修订版。该提交的提交 ID 与子模块本身的提交 ID 没有任何关系。

A commit updating a submodule just changes the revision git will checkout when you init/update the submodule. The commit id of that commit is in no way related to commit ids of the submodules itself.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文