How to lock commit if submodules have changed?

Is it possible to lock the latch using the pre-latch hook if:

  • Submodules have uncommitted changes
  • Submodules do not change at least one remote
  • Submodules are in a separate head state
+4
source share
1 answer

Find uncommitted changes: git submodule -q foreach git status --short. If there is any conclusion - commit block.

Search untested changes: git submodule -q foreach git branch --verbose | grep "ahead\|behind".

Check the detached head: git submodule -q foreach git rev-parse --symbolic-full-name HEAD. If there is at least one "HEAD" in the output-block command.

0
source

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


All Articles