Husky can prevent bad commit, push and more 🐶!
For example you can use husky to make sure files are formatted by prettier automatically so you don't have to worry about manually formatting files ever again and focus on the objective of the code instead. Here is the setup:
npm install husky -D
"precommit": "npm run prettier:write",
Now whenever you commit code and there are any formatting changes that need to be made, you'd get them as a modified file in your git log. You can now
- If you have pushed your code already, simply commit them with a comment
- If you haven't pushed your code, ammend your last commit and look like a superhero.