6

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.
$
Wilfred Hughes
  • 29,846
  • 15
  • 139
  • 192
  • Why was this closed? Its a valid question. – Ries Apr 30 '14 at 14:04
  • @Ries I requested it to be closed. I concluded it was a bug in git itself that I could only reproduce on a very large and messy repo. I didn't think other SO users would encounter precisely the same issue. – Wilfred Hughes Apr 30 '14 at 15:12

1 Answers1

2

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.

ThiefMaster
  • 310,957
  • 84
  • 592
  • 636
  • 1
    Sure. But I'm not expecting to see 5877e2 or b77ba6 in the parent project. However, 6877146 is a commit on the parent. `git log potatobase` shows commits on the parent (commits that changed the revision of the submodule), it's just missing 6877146. – Wilfred Hughes Feb 22 '12 at 18:01