1

We have quite a few repositories with submodules and we would like to report which submodules are candidates for upgrading because the repository they refer to has new commits. Is there a way to do this without changing the currently checked out version?

basically there are 3 different commits that we would like to know about;
1) the commit to which origin's containing repository is pointing to
2) the commit to which the local containing repository is pointing to (this might be different from 1 because of a manual pull of the submodule
3) the head of the submodule repository.

If local is behind origin we would like to do a submodule update.
If local is ahead origin, we don't want to do a submodule update because it is probably changed by the developer.
If local is behind the head of the submodule repository, we would like to get a warning.

Corno
  • 5,448
  • 4
  • 25
  • 41

1 Answers1

1

It's a bit verbose, but you can use awk, sed, etc. to prune it down to the pertinent information, but I would start with git submodule foreach git remote show or git submodule foreach git fetch; git submodule foreach git log master..origin/master. That should provide enough information to build a script to do the automatic updates, etc.

twalberg
  • 59,951
  • 11
  • 89
  • 84