git-smart-commit
v0.1.4
Published
This tool generates smart TODO comments for Git changes to nudge users to document them before commit.
Downloads
44
Maintainers
Readme
Git Smart Commit
This tool generates smart TODO comments for Git changes to nudge users to document them before commit.
Installation
- Run
npm install git-smart-commit
into your app and then follow the steps.
Working
Click below to watch the video
- Make changes to your code
- Do
git add .
- Do
git commit -m "your message"
- The script will catch your message, run its own inspection to ask you to document the changes you have made.
- It won't commit your changes until all the changes have been documented in this git commit.
- If all goes well, script checks your message format and proceed to commit.
- This is how the script appends the smart comment at the line where changes were made.
- All you have to do is replace
TODO
withFIX|DEBUG|INFO
and enter your message to match the allowed format.
Dependency
Make sure that your system has all these installed pre-hand.
- Git
- Sed
- Node
Post Installation Steps
- Make any small change in any of your file
git add .
git commit -m "your message"
- Notice the changes you have made in your files and document them
- That's it! Push the changes to your branch.
Add-on commands
I have added some add-on commands that give you full control over this package:
Pause : Pauses the commit validation until you restart. Good when you don't want to validate something.
npm run pause-smart-commit
Restart : Restarts the paused smart commit package.
npm run restart-smart-commit
Un-install : Removes the smart commit validation from git and allow you to work normally.
npm run uninstall-smart-commit
Install : Installs the smart commit validation back into git
npm run install-smart-commit
Tested on
- Linux
- Mac
TODO
- Test and adapt to windows
- Add more file support for comments
- Integrate ChatGPT for smart commit message to assist better.
Author
Sagar Chauhan works as a Senior Product Manager - Technology at Greenhonchos. In his spare time, he hunts bug as a Bug Bounty Hunter. Follow him at Instagram, Twitter, Facebook, Github
License
MIT