26

I know I can tell Git to show progress like

Resolving deltas:  98% (123/125)  

when passing the command line parameter --progress to, e.g. the fetch command. But we have a couple of large submodules and there no progress is shown. How to tell Git to also show progress for cloning submodules (e.g. as part of the fetch command)?

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
Thomas S.
  • 5,804
  • 5
  • 37
  • 72

2 Answers2

31

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)

kfunk
  • 2,002
  • 17
  • 25
2

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
'
Jesper Rønn-Jensen
  • 106,591
  • 44
  • 118
  • 155