Include submodule commit messages with "git log"
git
Solution
Here's a simple bash command that creates an ASCII commit graph (similar to gitk) that interleaves the relevant submodule commits when a submodule gets changed in the superproject. It prints out the full patch for every commit and then uses grep to filter out the patch contents leaving only the summary lines and submodule changes.
git log --graph --oneline -U0 --submodule Tag1..Tag2 | grep -E '^[*| /\\]+([0-9a-f]{7} |Submodule |> |$)'
It produces output similar to this:
* 854407e Update submodule
| Submodule SUB 8ebf7c8..521fc49:
| > Commit C
* 99df57c Commit B
* 79e4075 Commit A
Problem
Suppose I have two versions in my repository... each has been tagged as follows: - Tag1 - Tag2 Now suppose that a commit updated a submodule reference to point to a new submodule commit between Tag1 and Tag2. I run the following command, and get this: ``` # show commits between these two tags git log Tag1..Tag2 commit be3d0357b93322f472e8f03285cb3e1e0592eabd Author: James Johnston <snip> Date: Wed Jan 25 19:42:56 2012 +0000 Updated submodule references. ``` In this case, the only change was an update of the submodule. How do I get the submodule commits to be interleaved with the parent repository commits? Specifically, in this example, suppose that the parent repository points to the SubTag5 tag in the submodule. Two commits later in the submodule is a SubTag6 tag. The commit shown updated the submodule pointer to point to SubTag6 instead of SubTag5. What I would like to do is have `git log`, in addition to the commit it already printed, print the two submodule commits as well that brought the submodule from SubTag5 to SubTag6.