git-mods
v1.0.13
Published
Check to ensure there are no unstaged changes in a git repo
Downloads
37
Maintainers
Readme
git-mods
A common pattern is to find errors during the commit/push process due to tests,git-hooks etc. Once changes are made, it's all too common to finish the original commit that leaves these changes behind.
git-mods
automates this check. It provides a wrapper around git status
and parses the output to enable
git-mods
: Checks to ensure there are no modifications in the current repo.git-mods --staged_ok
: Checks to ensure no unstaged modifications exist. Staged modifications are acceptable.
Typically, git-mods --staged_ok
is a good option to include in a precommit
-hook and git-mods
to include in the prepush
-hook.
Installation & Usage
git-mods
is best used along with husky
, to easily add git-hooks to your repo.
To make it's installation easier, husky
uses a post install script to confgure any hooks specified. This results in a
slightly convoluted installation sequence. If you didn't read-the-manual the first time, just npm install husky
a second time
- First, add precommit/prepush hooks to the scripts section of
package.json
Inpackage.json:scripts
:
...
"scripts": {
"precommit": "git-mods --staged_ok",
"prepush": "git-mods"
}
...
- THEN, install the dependencies.
npm install git-mods husky --save-dev