Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/motiz88/git-exec-and-restage
Safely amend Git commits after applying auto-fixing tools
https://github.com/motiz88/git-exec-and-restage
Last synced: 15 days ago
JSON representation
Safely amend Git commits after applying auto-fixing tools
- Host: GitHub
- URL: https://github.com/motiz88/git-exec-and-restage
- Owner: motiz88
- License: mit
- Created: 2017-05-10T14:50:22.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-05-20T09:50:05.000Z (over 6 years ago)
- Last Synced: 2024-05-16T17:20:40.106Z (6 months ago)
- Language: JavaScript
- Size: 231 KB
- Stars: 17
- Watchers: 2
- Forks: 5
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# git-exec-and-restage
[![npm](https://img.shields.io/npm/v/git-exec-and-restage.svg)](https://www.npmjs.com/package/git-exec-and-restage)
[![Travis CI](https://img.shields.io/travis/motiz88/git-exec-and-restage/master.svg)](https://travis-ci.org/motiz88/git-exec-and-restage)
[![Codecov](https://img.shields.io/codecov/c/github/motiz88/git-exec-and-restage/master.svg)](https://codecov.io/gh/motiz88/git-exec-and-restage/)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/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](#install)
- [Usage](#usage)
- [Contribute](#contribute)
- [Acknowledgements](#acknowledgements)
- [License](#license)## Install
```sh
npm install git-exec-and-restage
```## Usage
Manually e.g. with `prettier`:
```sh
git-exec-and-restage prettier --write -- file1.js file2.js
```Automatically e.g. with `lint-staged`:
### `package.json`
```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`](https://github.com/mcwhittemore/staged-git-files).## License
MIT © Moti Zilberman