How do I check that a PR does not accidentally revert a submodule revision?


I just experienced a problem, in which a subsequent PR by another contributor accidentally reverted a submodule update committed by a prior PR. I suspect that the problem came from rebasing a PR to a recent master. Is there a way to check whether a PR doesn’t accidentally revert such a change? Or is to generalize the problem, is there a check for reverting any change made by prior PR?


That’s because submodules are tricky, every contributor should remember to check they are properly updated.

As for implementing a safe check, you could add to your repository a Git pre-commit hook (or another hook) that executes a script that will either updated or check the submodule pointer.

Via Git hooks, custom scripts and proper submodules strategy settings, you should be able to obtain complete control over them and avoid similar problems.