README
ΒΆ
π fast-cc-hooks
The fastest way for YOU, to write conventional commit messages for ALL your git commits!
Why Use Conventional Commits? Because when you use them, there's tooling (listed later in this page) that can:
- auto-generate CHANGELOG's AND even determine semantic version bumps
- make it dead simple for YOU and the community of coders to contribute to projects without crappy commit messages.
Value Prop: This performance obsessed "git companion" toolkit, provides tools that do the heavy lifting:
fast-cc-hooks- installs a git-hook (locally or globally with local install always taking precedence), that checks your commit messages, ensuring they comply to conventional commit format.cc- preview generated conventional commit messages, based on your changesccc- generate conventional commit messages AND commit (3 c's for "Create Conventional Commit") (most popular)
π― Key Benefits:
-
Flexibility: easily choose between system-wide or project-specific hook installation
-
Team collaboration: Local installation perfect for team projects with specific requirements
-
Personal workflow: Global installation ideal for individual developers wanting consistent validation
-
π Enhanced User Experience:
-
Smart Detection: Automatically detects both local and global installations
-
Interactive Prompts: User-friendly menu when both installations exist
-
Precise Control: --local and --global flags for specific removal
π― Real-World Scenarios Handled:
- Team Developer: Can remove only local hooks while keeping global ones
- Personal Setup: Can remove global hooks without affecting project-specific local ones
- Clean Slate: Can remove both installations when switching tools
- Accidental Installs: Can target specific installation types
π Perfect Workflow: Using ALL Tools Together
The tools are completely independent but work beautifully together:
Option 1: You write your own commit messages (with fast-cc-hooks installed)
# Write your commit message manually
git commit -m "feat: CGC-1245 Added login authentication"
# β³ The fast-cc-hooks hook, automatically validates your message β
Option 2: Commit messages are generated based on your changes (using ccc) and validated by the fast-cc-hooks hook
# Let ccc generate the conventional commit message and execute it for you
ccc
# β³ ccc analyzes your git changes and creates a conventional commit message
# β³ When git commit runs, the git hook (installed via fast-cc-hooks) validates the generated message β
# β³ which means: compliant conventional commits, every time!
You can mix and match:
- Use fast-cc-hooks alone: Ensures your manual commit messages get automatic validation
- Use cc alone: Preview generated conventional commit messages, based on your changes, but you do the commit yourself
- Use ccc alone: Generated compliant conventional commits, without validation (but why would you?)
- Use both: Generated conventional commits PLUS BONUS validation, talk about the perfect combo! π―
Pro tip: Start with ccc to see what good commit messages look like, then graduate to writing your own!
β‘οΈ Quick Setup (In 3 steps!)
Step 1: Install the tools
Option A: Download the Binary
Each release includes both tools - you get everything in one download!
*** Windows:**
- Go to Releases Page
- Download
fast-cc-hooks_windows_amd64.zip - Extract and add both
fast-cc-hooks.exeandcc.exeto a directory on your PATH NOTE: In windows, there's an option to change only your environment variables - use that as a preference, or just add both to your PATH.
π§ Linux:
# Most common (AMD64)
curl -L -o fast-cc-hooks.tar.gz https://github.com/greenstevester/fast-cc-git-hooks/releases/latest/download/fast-cc-hooks_linux_amd64.tar.gz
tar -xzf fast-cc-hooks.tar.gz
chmod +x fast-cc-hooks cc
sudo mv fast-cc-hooks cc /usr/local/bin/
# ARM64 (Raspberry Pi, etc.)
curl -L -o fast-cc-hooks.tar.gz https://github.com/greenstevester/fast-cc-git-hooks/releases/latest/download/fast-cc-hooks_linux_arm64.tar.gz
tar -xzf fast-cc-hooks.tar.gz
chmod +x fast-cc-hooks cc
sudo mv fast-cc-hooks cc /usr/local/bin/
π macOS:
# Intel Macs
curl -L -o fast-cc-hooks.tar.gz https://github.com/greenstevester/fast-cc-git-hooks/releases/latest/download/fast-cc-hooks_darwin_amd64.tar.gz
tar -xzf fast-cc-hooks.tar.gz
chmod +x fast-cc-hooks cc
sudo mv fast-cc-hooks cc /usr/local/bin/
# Apple Silicon (M1/M2/M3) - most common now
curl -L -o fast-cc-hooks.tar.gz https://github.com/greenstevester/fast-cc-git-hooks/releases/latest/download/fast-cc-hooks_darwin_arm64.tar.gz
tar -xzf fast-cc-hooks.tar.gz
chmod +x fast-cc-hooks cc
sudo mv fast-cc-hooks cc /usr/local/bin/
Step 2: Verify tools work on your machine (a.k.a. "Is it installed ...smoke test?")
fast-cc-hooks version # shows version info
cc --verbose # runs cc in verbose mode
ccc --verbose # runs cc in verbose mode
If you see version/help info for both, you're good to go! If not, make sure all tool are on your PATH.
π οΈ Step 3: Setup
Global Installation (Default - Recommended)
fast-cc-hooks setup # For standard projects
fast-cc-hooks setup-ent # For enterprise projects with JIRA validation
Local Installation (Current Repository Only)
fast-cc-hooks setup --local # Install only for current repository
fast-cc-hooks setup-ent --local # Enterprise setup for current repository only
What the Setup Commands Do
- User-friendly: Includes helpful messages, emoji, and step-by-step feedback
- Comprehensive: Does TWO things automatically:
- Creates/checks configuration: Ensures a config file exists (creates default if needed)
- Installs hooks: Then installs the git hooks
- Guided experience: Shows exactly what it's doing with clear output
- Global vs Local Installation:
- Global (default): Installs hooks for ALL git repositories on your system
- Local (--local): Installs hooks only for the current repository
- β‘ Precedence Rule: When both exist, local always takes precedence over global configuration
π Configuration Precedence (Important!)
When you have both local and global installations:
Local Repository Hook β€ ALWAYS WINS β‘
Global Git Hook β€ Ignored when local exists
Real-World Example:
- Global setup: Enforces standard conventional commits for all your projects
- Local setup: Project has specific JIRA validation rules
- Result: The local JIRA rules apply, global rules are ignored
This design lets you have:
- Personal defaults (global) for your general workflow
- Project-specific overrides (local) for team requirements
That's it! π Now every time you make a commit, compliant conventional commit messages will be your default.
β¨ How to write good commit messages
Instead of writing messy commits like:
git commit -m "fixed stuff"
git commit -m "update"
git commit -m "CGC-0000 blah blah blah"
Write clear commits like:
git commit -m "feat: add login button"
git commit -m "fix: CGC-4561 Resolved login bug"
git commit -m "docs: update README"
The format is simple: type: what you did
Common types:
feat- when you add something newfix- when you fix a bugdocs- when you update documentationtest- when you add testschore- when you do maintenance stuff
Commands (fast-cc-hooks)
fast-cc-hooks setup-ent # Set up everything (start here!)
fast-cc-hooks remove # Smart removal - prompts to choose local/global if both exist
fast-cc-hooks remove --local # Remove only from current repository
fast-cc-hooks remove --global # Remove only from global git configuration
Test things:
fast-cc-hooks validate "freak: my terrible message" # Test if a message is bad
Commit Helper Commands (cc)
Smart commit generation:
cc # Preview generated commit message
ccc # Generate perfect commit message and commit
cc --verbose # Show detailed analysis of your changes
cc --help # Show all available options
That's it! Most people only ever need fast-cc-hooks setup-ent and ccc.
π€ Common Questions
Q: Do I need all tools? A: No! They're completely independent. Install hooks for validation, ccc for generation, or both together.
Q: What if I want to turn off validation temporarily?
A: Just run fast-cc-hooks remove and it's gone! Run fast-cc-hooks setup-ent to turn it back on.
Q: Will this mess up my code? A: Nope! The hooks only check commit messages, cc only generates them. Your code stays exactly the same.
Q: What if cc generates a bad commit message? A: The hook will catch it! That's why they work so well together.
Q: Can I use this on all my projects?
A: Yes! When you run fast-cc-hooks setup-ent, it works for ALL your Git projects. cc works in any git repo.
Q: What if I don't like the cc generated message?
A: Just use cc (without ccc) to preview first, then write your own and let the hook validate it!
π― Examples of Good vs Bad Commits
β Bad commits (these will be rejected):
git commit -m "fix"
git commit -m "updated stuff"
git commit -m "asdf"
git commit -m "WIP"
β Good Enterprise commits (these will work):
git commit -m "feat: CGC-5641 Added user login page"
git commit -m "fix: CAHC-4132 Resolve password validation bug"
git commit -m "docs: LIND-4777 installation instructions"
βοΈ Want to Customize? (Optional)
Most people don't need to do this! The tool works great out of the box.
But if you want to customize the rules, run:
fast-cc-hooks init
This creates a file called fast-cc-config.yaml in your home directory (~/.fast-cc-git-hooks/) that you can edit. It has comments explaining everything!
π¨ Troubleshooting
Problem: The tool says my commit message is bad, but I think it's fine!
Run this to test your message:
fast-cc-hooks validate "your message here"
It will tell you exactly what's wrong and how to fix it.
Problem: I want to turn it off for just one commit
You can't bypass it easily (that's the point!), but you can run:
fast-cc-hooks remove
git commit -m "your message"
fast-cc-hooks setup
Problem: It's not working at all
Try setting it up again:
fast-cc-hooks remove
fast-cc-hooks setup-ent
ποΈ Advanced Examples
Want to include ticket numbers? (like JIRA tickets)
git commit -m "feat: CGC-1234 add user login"
git commit -m "fix: PROJ-456 resolve password bug"
Want to use scopes? (optional grouping)
git commit -m "feat(auth): add login form"
git commit -m "fix(api): resolve timeout issue"
git commit -m "docs(readme): update setup instructions"
The part in () is called a "scope" - it's like a category for your change.
π¨βπ» For Developers
Want to help make this tool better?
git clone https://github.com/greenstevester/fast-cc-git-hooks.git
cd fast-cc-git-hooks
make build
make test
All commits to this project must follow conventional format too! π
π Changelog Generation Tools
Once you're using conventional commits, you can automatically generate changelogs and manage versioning! Here are the most popular tools:
π Fully Automated Release Tools (Recommended)
-
semantic-release - The gold standard for automated releases
- Fully automates: version bumping, changelog generation, git tagging, and publishing
- Works with GitHub, GitLab, npm, Docker, and more
- Perfect for CI/CD pipelines
-
commit-and-tag-version - Drop-in replacement for
npm version- Handles version bumping, tagging, and CHANGELOG generation
- Great for manual releases with automation
π Changelog-Focused Tools
-
conventional-changelog - The original changelog generator
- Generate changelog from git metadata
- Multiple presets (Angular, Atom, etc.)
- Highly customizable
-
git-cliff - Modern Rust-based changelog generator
- Highly customizable templates
- Fast and reliable
- Great for complex projects
π’ Enterprise & Monorepo Tools
-
cocogitto - Complete conventional commits toolkit
- Version bumping, changelog generation, and commit linting
- Great for complex workflows
-
versio - Monorepo-compatible versioning
- Handles project dependencies
- Generates tags and changelogs
βοΈ Language-Specific Tools
- Go: chglog - Template-based changelog generation
- Python: python-semantic-release
- PHP: php-conventional-changelog
- Java: git-changelog-lib
π― Quick Start Recommendations
- For automated CI/CD: Use
semantic-release - For manual releases: Use
commit-and-tag-version - For just changelogs: Use
conventional-changelogorgit-cliff - For monorepos: Use
versioorcocogitto
All these tools work perfectly with the conventional commit messages that fast-cc-hooks enforces! π
π License
MIT License - do whatever you want with this code!
That's everything! Remember: just run fast-cc-hooks setup and start writing better commits! π
Directories
ΒΆ
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
cc
command
|
|
|
ccc
command
|
|
|
fast-cc-hooks
command
fast-cc-hooks is a fast conventional commits git hook system.
|
fast-cc-hooks is a fast conventional commits git hook system. |
|
internal
|
|
|
config
Package config provides configuration management for fast-cc-hooks.
|
Package config provides configuration management for fast-cc-hooks. |
|
hooks
Package hooks provides git hook installation and management.
|
Package hooks provides git hook installation and management. |
|
validator
Package validator provides commit message validation against conventional commit rules.
|
Package validator provides commit message validation against conventional commit rules. |
|
pkg
|
|
|
conventionalcommit
Package conventionalcommit provides parsing and validation for conventional commit messages.
|
Package conventionalcommit provides parsing and validation for conventional commit messages. |