🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more →
Socket
Book a DemoInstallSign in
Socket

git-exec-and-restage

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

git-exec-and-restage

Safely amend Git commits after applying auto-fixing tools

latest
Source
npmnpm
Version
1.1.1
Version published
Maintainers
1
Created
Source

git-exec-and-restage

npm Travis CI Codecov semantic-release

Safely amend Git commits after applying auto-fixing tools

git-exec-and-restage executes a command for you on a set of files. This command may modify the files (imagine a linter in auto-fix mode, like prettier --write or eslint --fix). If the files were fully staged before the command ran, the changes will be automatically added to the Git index; if they were partially changed the Git index will remain untouched.

Table of Contents

Install

npm install git-exec-and-restage

Usage

Manually e.g. with prettier:

git-exec-and-restage prettier --write -- file1.js file2.js

Automatically e.g. with lint-staged:

package.json

{
  "scripts": {
    "precommit": "lint-staged"
  },
  "lint-staged": {
    "*.js": ["git-exec-and-restage eslint --fix --"]
  }
}

Contribute

PRs welcome.

Acknowledgements

This package owes a great deal to Matthew Chase Whittemore's staged-git-files.

License

MIT © Moti Zilberman

FAQs

Package last updated on 20 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts