Example repository with git hooks configuration
This repository was created for the purposes of the Git hook is the new Husky article.
pre-commit
hook should be triggered in every operating system.
To use this repository you will need node.js
, npm
and git
. If you have it, then you can run those command in your terminal
/ git-bash
/ cmd
/ power-shell
.
git clone https://github.com/kaczor6418/git-hooks-example.git
cd git-hooks-example/
npm install
You have to run
npm install
ornpm postinstall
to set upgit-hooks
To check does pre-commit
hook works you can do one of the following and then run git-commit
to trigger this hook:
- use
let
for variables which can beconst
→ it should be changed intoconst
automatically, - use
""
(double quote) for any text → it should be changed into''
(single quote) automatically, - do not use
;
(semicolon) at the end of the line →;
(semicolon) should be added at the end of each line automatically
You can change already prepared
index.js
file