Git configuration for chia33164
Move to the root of the repository, and then copy the files in git-config/hooks/
to the repository:
$ cd <target repository>/
$ cp <path to git-config>/hooks/commit-msg .git/hooks/ && chmod +x .git/hooks/commit-msg
$ cp <path to git-config>/hooks/pre-commit .git/hooks/ && chmod +x .git/hooks/pre-commit
Setup the hooks when you type git init
in the repository.
$ mkdir -p ~/.git-templates
$ git config --global init.templatedir '~/.git-templates'
$ cp -r <path to git-config>/hooks ~/.git-templates/
$ cd <target repository> && git init
You can safely run git init
in the repository with .git
directory.
The hook is trigged by the command git commit
.
When you trig commit
, the hook will automatically do spell checking (GNU Aspell), coding style checking (clang-format), static analysis (cppcheck), and unsafe functions removal (e.g. gets, sprintf, strcpy).
The hook is trigged after finishing editing a commit message, and it will automatically check whether the commit is a good commit. Based on git-good-commit, I extend a function to do spell checking with GNU Aspell in order to avoid missing spelling.