1

I am unable to understand why a particular commit seems to have just vanished from my git history even though I can see it from a previous commit in my branch.

You can see that master contains the tag v2.1.1.332:

$ git branch --contains v2.1.1.332
* master

Here's the commit log for lib/facebook-ios-sdk from master:

$ git log --format=%h master -- lib/facebook-ios-sdk
4b23dc7
3cc007d
b14fbda
3e5c85d
ab962d1
d3da048
d765573

Note that lib/facebook-ios-sdk is a git submodule, not a regular path in my git repo.

And commit log for the same path from v2.1.1.332:

$ git log --format=%h v2.1.1.332 -- lib/facebook-ios-sdk
e5ed45f
4b23dc7
3cc007d
b14fbda
3e5c85d
ab962d1
d3da048
d765573

Notice the commit e5ed45f; its apparently present in v2.1.1.332 but not in master! How is this possible?

Even more interesting, git-branch indicates that master does contain e5ed45f:

$ git branch --contains e5ed45f
* master

Also, when I run git log master, I do get e5ed45f in the list. Its just that I don't see this commit when I specify the path with git log.

Why am I asking all this? While this in itself is a curios state of things, we noticed that the submodule lib/facebook-ios-sdk had erroneously been set to a previous commit (the one in 4b23dc7's tree). We started looking for the bad commit using git log master -- lib/facebook-ios-sdk and that's when we encountered this. Right now we have no idea how this submodule's commit was changed to a previous value.

EDIT wereHamster on #git pointed me to git log --full-history. Using this option does show the missing commit:

$ git log --format=%h --full-history master -- lib/facebook-ios-sdk
e5ed45f
4b23dc7
3cc007d
b14fbda
3e5c85d
ab962d1
aa43dc3
d3da048
d765573

However it still doesn't explain why the wrong commit is checked out for the submodule:

$ git show --format=%b e5ed45f -- lib/facebook-ios-sdk


diff --git a/lib/facebook-ios-sdk b/lib/facebook-ios-sdk
index cb42580..de7509b 160000
--- a/lib/facebook-ios-sdk
+++ b/lib/facebook-ios-sdk
@@ -1 +1 @@
-Subproject commit cb425807b1f25f916e48b35e06197bccc8b881be
+Subproject commit de7509b8bff6df7163738a979567a72fd4a13ff8

# This command was run on master
$ git submodule lib/facebook-ios-sdk
 cb425807b1f25f916e48b35e06197bccc8b881be lib/facebook-ios-sdk (v1.1-20-gcb42580)
4
  • 1
    If the commit is pruned when you don't use --full-history then it must be on a branch that had no effect on your selected path when merged. Can you re-run the --full-history with --graph?
    – CB Bailey
    Jan 8, 2013 at 6:40
  • Thanks -- git log --full-history --graph -- lib/facebook-ios-sdk gave a bunch of merge commits alongwith the previous output. We had previously identified the culprit -- it was a merge commit on a topic branch which should have included the change but didn't. However the output of the --full-history --graph included too many merges for it to be meaningful. We got to the culprit by manually diffing all the merges between the two heads. Jan 8, 2013 at 7:53
  • What do you mean by "culprit"? Isn't your question about why a particular commit is pruned from a given log output?
    – CB Bailey
    Jan 8, 2013 at 8:32
  • Yup the question is specifically about why the commit is pruned from the git log output. However I also explained the real reason why I asked this question (just before the edit) i.e. why should the submodule be set to an older commit when the most recent commit related to this submodule apparently was e5ed45f. The "culprit" in this case was a merge commit on a topic branch which ostensibly included the submodule's commit when master was merged into it but actually did not i.e. we (inadvertently) reverted the submodule's value before committing the merge. Jan 8, 2013 at 11:42

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.