How to show progress for submodule fetching?

Starting with Git v2.11.0, the git submodule interface accepts the --progress option which you can use. It does exactly what you expect.

See: https://github.com/git/git/commit/72c5f88311dab7149fcca1f6029414ccb776fee8

--progress wasn't announced in the help text (git submodule --help) in earlier versions but now it is (tested with Git version 2.27.0)


The closest I came was to use this command:

git fetch --recurse-submodules=yes --jobs=10

This is not giving you a progress bar. But it speeds up the fetching of the repositories. This helped me a whole lot on a microservice project with ~30 submodules.

Of course, you can combine this with other commands afterwards, for example, update all repositories without potential conflicts:

# run all subprojects updates: Pull on currently selected branches

#git submodule foreach 'git rebase origin/master; true'
git submodule foreach '
  export BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
  git status -bs
  if [[ "master" == $BRANCH_NAME ]]
  then
    git merge FETCH_HEAD --ff-only
  else
    echo \"NOTE this branch is $BRANCH_NAME. You must merge/rebase yourself!\"
  fi
'

Tags:

Git