Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git history including/interleave submodule commits

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 

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.

What's missing?

like image 781
pagid Avatar asked Jan 12 '12 23:01

pagid


People also ask

How can I see my submodule commit?

If you want to check for new work in a submodule, you can go into the directory and run git fetch and git merge the upstream branch to update the local code. Now if you go back into the main project and run git diff --submodule you can see that the submodule was updated and get a list of commits that were added to it.

How do I see my entire git history?

Git file History provides information about the commit history associated with a file. To use it: Go to your project's Repository > Files. In the upper right corner, select History.

How do I checkout a specific commit of a submodule?

If you want to go to a particular commit of a git repository with submodules you can use 2 git commands: reset or checkout. You will also need to synchronise the submodules after the working directory has been altered as that doesn't happen automatically.


1 Answers

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.

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
like image 61
Simon Whitaker Avatar answered Oct 14 '22 01:10

Simon Whitaker