✨ Added pre-commit hook to handle submodules #8302
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a pre-commit hook that developers can install to remind them NOT to commit submodules. It is borrowed very heavily from https://github.com/chaitanyagupta/gitutils/blob/master/submodule-hooks/pre-commit, but I modified the output to closely resemble
git status
.At the moment, this would have to be installed manually:
cp .github/hooks/pre-commit ./git/hooks/pre-commit
chmod ugo+x .git/hooks/pre-commit
We could use the
npm postinstall
hook to automatically install this using a symlink. There is a node module that would do this for us, but it makes certain assumptions.Not sure how everyone feels - should we be building up a library of hooks & auto-linking them to make everyone's life easier, or does this feel too intrusive?
refs #8235
Usage:
In the root of your repo run
cp .github/hooks/pre-commit ./git/hooks/pre-commit
chmod ugo+x .git/hooks/pre-commit
git st
to make it easy to read