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: 4 months 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 (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-20T09:50:05.000Z (almost 7 years ago)
- Last Synced: 2024-05-16T17:20:40.106Z (9 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
[](https://www.npmjs.com/package/git-exec-and-restage)
[](https://travis-ci.org/motiz88/git-exec-and-restage)
[](https://codecov.io/gh/motiz88/git-exec-and-restage/)
[](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