Package Exports
- commit-guardian
- commit-guardian/git-approve
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (commit-guardian) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Git Approve - CLI Commit Review Tool
A CLI tool that opens a browser-based diff viewer for reviewing git changes before committing. Inspired by difit but adds an approval workflow for safe commits.
✨ Features
- 🔍 GitHub-style diff viewer in browser
- 💬 Line-by-line comments on changes
- ✅ Approval workflow - approve to commit or reject to cancel
- 🚀 Auto-commit after approval with custom commit message
- 📋 Staged & unstaged changes support
- 🙈 Respects .gitignore - ignored files are not shown
📦 Installation
- Clone or copy the
git-approvescript to your local machine - Install Node.js dependencies:
npm install
- Make the script executable:
chmod +x git-approve - (Optional) Add to your PATH for global access:
sudo ln -s $(pwd)/git-approve /usr/local/bin/git-approve
🚀 Usage
Navigate to any git repository and run:
./git-approveOr if installed globally:
git-approveCommand Line Options
# Basic usage
git-approve
# With default commit message
git-approve "Add new feature"
git-approve -m "Fix login bug"
git-approve --message "Update documentation"
# Show help
git-approve --helpWorkflow
- Run the command in your git repository
- Browser opens automatically showing your changes
- Review diffs with GitHub-like interface
- Add comments (optional) by clicking the 💬 button on any line
- Write commit message in the text area
- Click "✅ Approve & Commit" to commit or "❌ Reject" to cancel
Example Output
🔍 Git Approve - Review changes before commit
📊 Changes detected:
• Staged changes found
• Unstaged changes found
📝 Default commit message: "Add new feature"
🚀 Review server started at http://localhost:3456
🌐 Opening browser...
⏳ Waiting for your review...
• Review changes in browser
• Add comments if needed
• Approve to commit or reject to cancel
Press Ctrl+C to cancelAfter approval:
✅ Changes approved!
📝 Commit message: Add new feature with validation
💬 Comments:
1. src/app.js:42 - Consider using const instead of let
2. src/app.js:58 - Add error handling here
🎉 Successfully committed changes!🔧 Configuration
The tool runs on port 3456 by default. If you need to change this, edit the PORT constant in the script.
⚠️ Requirements
- Node.js (v14 or higher)
- Git repository
- Modern web browser
🆚 Differences from difit
| Feature | difit | git-approve |
|---|---|---|
| View diffs | ✅ | ✅ |
| Add comments | ✅ | ✅ |
| Browser interface | ✅ | ✅ |
| Approval workflow | ❌ | ✅ |
| Auto-commit on approve | ❌ | ✅ |
| Pre-commit safety | ❌ | ✅ |
| Staged/unstaged combo | ✅ | ✅ |
🔒 Safety Features
- Only shows changes that would be committed
- Requires explicit approval to commit
- Shows both staged and unstaged changes
- Respects .gitignore automatically
- Comments are preserved for review
🤝 Contributing
Feel free to submit issues and enhancement requests!
📄 License
MIT License - feel free to use and modify as needed.