How can I find out if the git submodule has new commits

We have quite a few repositories with submodules, and we would like to inform you which submodules are candidates for updating, because the repository to which they belong has new commits. Is there a way to do this without changing the current version?

basically there are 3 different commits that we would like to know about.
1) commit, for which the source containing the repository points to 2) commit, indicated by the local containing repository (this may differ from 1 due to manual attraction of the submodule
3) the head of the submodule storage.

If the local source is behind, we would like to update the submodule.
If moving forward locally, we don’t want to update the submodule because it is likely to be changed by the developer.
If the local value is located behind the header of the submodule repository, we would like to receive a warning.

0
source share
1 answer

This is a bit detailed, but you can use awk, sedetc. to shorten it to the relevant information, but I would start with git submodule foreach git remote showor git submodule foreach git fetch; git submodule foreach git log master..origin/master. This should provide enough information to create a script for automatic updates, etc.

0
source

Source: https://habr.com/ru/post/1531745/


All Articles