Recursive Git push/pull?

David Y. Stephenson picture David Y. Stephenson · Jul 10, 2013 · Viewed 16.3k times · Source

I have a git repository that contains other git repositories. Are there commands that recursively push and/or pull for not only the meta-repository but the sub-repositories?

Answer

vguerra picture vguerra · Jan 19, 2014

I find myself in the same situation whenever I want to update my llvm/clang repositories and with a bit of bash help I can 'git pull' each of them like this:

$> for dir in $(find . -name ".git"); do cd ${dir%/*}; git pull ; cd -; done

This will 'git pull' all git repos found under your current directory, and probably wont work if they are bare repositories.