git-mods

1.0.13 • Public • Published

git-mods

npm license build
NPM

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

  1. git-mods: Checks to ensure there are no modifications in the current repo.
  2. 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 In package.json:scripts:
...
"scripts": {
  "precommit": "git-mods --staged_ok",
  "prepush": "git-mods"
}
...
  • THEN, install the dependencies.
npm install git-mods husky --save-dev

Package Sidebar

Install

npm i git-mods

Weekly Downloads

4

Version

1.0.13

License

Apache-2.0

Unpacked Size

25.9 kB

Total Files

6

Last publish

Collaborators

  • sramam