is it possible to show the tag of a current submodule without having to be inside its directory?
I would want to do something like
git describe --tags <submodule_dir>
and return the particular tag.
You can use git submodule foreach
(doc here) to run a command from within each submodule :
# something like the following should work :
git submodule foreach 'echo $name : `git describe --tags`'
For a command such as git describe
(which extracts its information only from the .git/
directory, not from the working tree), you can pass the git directory as an argument to the git
command :
# the .git directory for a submodule can be found under .git/modules/module_name :
git --git-dir=.git/modules/module_name describe --tags