Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

git-mods

sramam45Apache-2.01.0.13

Check to ensure there are no unstaged changes in a git repo

git, status, stage, unstage, unstaged

readme

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