The commit id associated with the submodule is stored as a commit
object in the tree
object for the directory containing the submodule. For example, I have packstack checked out locally which has a number of submodules in packstack/puppet/modules
; we can see the commits like this:
$ git ls-tree HEAD | awk '/packstack/ {print $3}'
e7f8ff02ee9ceb26df165439fdffdad13e7ffe63
$ git ls-tree e7f8ff02ee9ceb26df165439fdffdad13e7ffe63 | awk '/puppet/ {print $3}'
0f710acfee985c3f8c3e559425a76194a4a809ea
$ git ls-tree 0f710acfee985c3f8c3e559425a76194a4a809ea | awk '/modules/ {print $3}'
1ccbe1d23c3ae2f2fe6aab987dd8d84d634012ef
$ git ls-tree 1ccbe1d23c3ae2f2fe6aab987dd8d84d634012ef
160000 commit 6d2dc044e12c4c687647cff8bc60c981d9ed5312 heat
160000 commit 17ba6a73cec7f386922e6a914a120a829e225efc horizon
160000 commit fe9b0d5229ea37179a08c4b49239da9bc950acd1 inifile
160000 commit bb67ef3e0a7c605cee97f9a8ccd13000290f9b39 keystone
.
.
.
And of course you can see the commit ids for previous versions of your repository by starting somewhere other than HEAD
.