How to list all subtrees or submodules of your git repository

By default git doesn't provide any command to list all subtrees of your current git repository.
For submodules you can use the submodule--helper, but this is not very convenient either.
So let's fix this:

Add list-subtrees and list-submodules as alias

Add to your ~/.gitconfig file the following aliases and save it:

[alias]
    list-subtrees = !"for i in $(git log | grep git-subtree-dir | sed -e 's/^.*: //g' | uniq); do test -d $i && echo $i; done"
    list-submodules = submodule--helper list

Now you can use the following command to list all the subtrees of your git repository:

cd myRepo/
git list-subtrees
git list-submodules

If you know a better solution, please let me know: sven@skom.de

Comments

No Comments

Write comment

* These fields are required