Usage Guide¶
Comprehensive guide to all Conventional Commits Generator commands and features.
Basic Command¶
Interactive Commit¶
The most common way to use CCG is the interactive mode:
This starts the interactive prompt that guides you through creating a conventional commit.
Command-Line Flags¶
CCG supports various flags to customize its behavior:
--commit: Generate Message Only¶
Generate a commit message without actually creating a commit:
Use Cases:
- Preview commit message format
- Test your commit message before committing
- Generate messages for documentation or examples
--push: Push Without Committing¶
Push existing commits to remote without creating a new commit:
Use Cases:
- Push commits you've already created
- Retry a failed push
- Push to a new branch that doesn't exist remotely
Features:
- Automatically detects if branch exists on remote
- Offers to create remote branch with
--set-upstreamif needed - Checks remote access before pushing
--edit: Edit Existing Commits¶
Edit commit messages of existing commits:
Features:
- Select from recent commits or enter commit hash
- Validates new message against conventional commits format
- Uses
git commit --amendfor latest commit (fast) - Uses
git filter-branchfor older commits (rewrites history) - Offers force push for commits already on remote
Workflow:
- Choose how many recent commits to display
- Select commit by number or hash
- View current commit details
- Enter new commit message and body
- Review changes
- Confirm edit
- Optionally push with force flag
Warning: History Rewriting
Editing commits rewrites git history. If the commit has been pushed:
- Force push will be required
- May affect other collaborators
- Should be avoided on shared branches (like
main)
--delete: Delete Existing Commits¶
Delete commits from history:
Features:
- Interactive commit selection
- Shows full commit details before deletion
- Uses
git reset --hard HEAD~1for latest commit - Uses interactive rebase for older commits
- Requires explicit confirmation
- Offers force push for commits already on remote
Workflow:
- Choose how many recent commits to display
- Select commit by number or hash
- View commit details
- Confirm deletion (with warnings)
- Commit is permanently removed
- Optionally force push
Warning: Destructive Operation
Deleting commits is irreversible. Make sure you:
- Have a backup if needed
- Understand the impact on commit history
- Coordinate with team members for shared branches
- Use force push carefully
--tag: Create and Push Tags¶
Create semantic version tags:
Features:
- Validates tag format (Semantic Versioning)
- Supports annotated tags with messages
- Checks remote access before pushing
- Pushes tag to remote automatically
Workflow:
- Enter tag name (validated against SemVer)
- Choose between annotated or lightweight tag
- Enter tag message (for annotated tags)
- Confirm push to remote
Semantic Versioning
CCG validates tags against SemVer 2.0.0 specification:
MAJOR.MINOR.PATCH- Optional pre-release:
-alpha,-beta.1 - Optional build metadata:
+20250112
--reset: Discard Changes and Pull¶
Reset local changes and pull latest from remote:
Features:
- Discards all uncommitted changes
- Removes untracked files
- Pulls latest from remote
- Requires explicit confirmation
Workflow:
- Check for local changes
- Show destructive warning
- Require user confirmation
- Discard changes with
git reset HEAD,git checkout .,git clean -fd - Pull latest with
git pull
Warning: Data Loss
This operation is destructive and irreversible:
- All uncommitted changes are lost
- Untracked files are deleted
- Cannot be undone
--analyze: Analyze Commit Compliance¶
Analyze all commits in the repository to check Conventional Commits compliance:
Features:
- Analyzes all commits or recent N commits
- Validates each commit against Conventional Commits format
- Color-coded output (green ✓ for valid, red ✗ for invalid)
- Shows numbered list for easy identification
- Provides summary statistics (total, valid %, invalid %)
- Suggests using
--editto fix invalid commits
Workflow:
- Choose how many commits to analyze (or all)
- View analysis results with validation status
- Review summary statistics
- Use suggested commit numbers with
--editto fix issues
Example Output:
┌──────────────────────┐
│ Analyze Commits │
└──────────────────────┘
How many commits to analyze? (Enter for all, or a number): 5
Analyzing last 5 commits...
┌──────────────────────┐
│ Analysis Results │
└──────────────────────┘
1. ✓ [a3c6dbc] feat(ux): improvements in usability and responsiveness
2. ✓ [97c2e52] chore: removing unnecessary comments
3. ✗ [2812ed3] update bump version workflow
4. ✓ [fa6a6df] feat: adding improvements
5. ✓ [a5309a3] chore: add CODE_IMPROVEMENTS.md
┌──────────────────────┐
│ Summary │
└──────────────────────┘
Total commits analyzed: 5
Valid commits: 4 (80%)
Invalid commits: 1 (20%)
How to fix invalid commits:
• Use 'ccg --edit' to edit a specific commit message
• You can select commits by number or hash prefix
• Example: 'ccg --edit' then select the commit to fix
⚠ Tip: Run 'ccg --edit' now to fix invalid commits
Use Cases:
- Audit repository for Conventional Commits compliance
- Identify commits that need fixing before a release
- Validate commit history after team adoption of conventional commits
- Check compliance across all branches
- Find and fix non-compliant commits systematically
Combined with Other Flags:
# Analyze commits in different repository
ccg --path /path/to/repo --analyze
# Analyze with verbose logging
ccg --verbose --analyze
ccg -v --analyze
Best Practice
Use --analyze regularly to:
- Maintain consistent commit history
- Enforce team conventions
- Prepare for releases with clean commit messages
- Identify which commits need editing (use the number shown)
--path: Work with Specific Paths¶
Specify files, directories, or repository paths:
Two Modes:
Mode 1: Change Working Directory¶
When providing a single directory, CCG changes to that directory and operates there:
Mode 2: Stage Specific Files¶
When providing multiple paths or files, CCG stages only those paths:
Combined with Other Flags:
# Edit commit in different repository
ccg --path /path/to/repo --edit
# Push from different repository
ccg --path /path/to/repo --push
# Create tag in specific repository
ccg --path /path/to/repo --tag
Validation:
- Paths must exist
- Paths must be within a git repository
- Invalid paths show helpful error messages
--verbose: Enable Debug Logging¶
Enable verbose logging for debugging and troubleshooting:
Features:
- Logs all operations to
~/.ccg/ccg.log(always enabled) - Shows debug output in console when
--verboseis used - Logs include timestamps, module names, function names, and line numbers
- Rotating log files (10MB max, keeps 5 backups)
Use Cases:
- Debugging issues with git commands
- Troubleshooting authentication problems
- Understanding what CCG is doing behind the scenes
- Reporting bugs with detailed logs
Combined with Other Flags:
# Debug push issues
ccg --verbose --push
# Debug commit editing
ccg -v --edit
# Debug with specific paths
ccg --verbose --path /path/to/repo
Log Format:
2025-10-13 23:58:34 - ccg.cli - INFO - main:123 - CCG started (version 2.2.8)
2025-10-13 23:58:35 - ccg.git - DEBUG - run_git_command:145 - Executing git command: git status
2025-10-13 23:58:35 - ccg.git - INFO - git_commit:289 - Creating commit with message: feat: add...
Log Location:
- Linux/Mac:
~/.ccg/ccg.log - Windows:
%USERPROFILE%\.ccg\ccg.log
When to Use Verbose Mode
Use --verbose when:
- Reporting bugs or issues
- Troubleshooting git authentication
- Understanding unexpected behavior
- Debugging pre-commit hooks
--version: Show Version¶
Display CCG version information:
--help: Show Help¶
Display usage information and available flags:
Error Handling¶
CCG provides clear error messages for common issues:
Not a Git Repository¶
Solution: Run git init or cd to a git repository.
No Remote Configured¶
Solution: Add a remote: git remote add origin <url>
No Changes to Commit¶
Solution: Make changes to files, then run CCG.
Access Denied¶
✗ ACCESS DENIED: You don't have permission to access this repository.
✗ Please check:
You have push access to this repository
The repository URL is correct
You're logged in with the correct account
Solution: Check your git credentials and repository permissions.