-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
Griffen Fargo edited this page Oct 6, 2025
·
1 revision
Welcome to coco! This guide will take you from installation to generating your first AI-powered commit message in just a few minutes.
coco is an AI-powered git assistant that generates meaningful commit messages from your staged changes. It supports:
- 🤖 Smart commit generation from code changes
- 📋 Conventional commits with automatic validation
- 🔧 Commitlint integration for team consistency
- 🏠 Local AI models (Ollama) or cloud APIs (OpenAI, Anthropic)
- 📦 All package managers (npm, yarn, pnpm)
# Try coco immediately without installation
npx git-coco@latest init
# Generate your first commit message
npx git-coco@latest commit# Install globally with npm
npm install -g git-coco
# Or with yarn
yarn global add git-coco
# Or with pnpm
pnpm add -g git-coco# Install in your project
npm install --save-dev git-coco
# Add to package.json scripts
{
"scripts": {
"commit": "coco commit"
}
}# Interactive setup wizard
coco init
# Or specify scope directly
coco init --scope global # For all your projects
coco init --scope project # For current project onlyThe wizard will guide you through:
- Choosing AI provider (OpenAI, Anthropic, or Ollama)
- Setting up authentication (API keys or local models)
- Configuring preferences (conventional commits, interactive mode, etc.)
For Beginners (Recommended): OpenAI
- Most reliable and fast
- Excellent commit message quality
- Requires API key (~$0.01-0.05 per commit)
For Privacy/Cost-Conscious: Ollama
- Completely local and private
- No API costs after setup
- Requires more setup and hardware
For Advanced Users: Anthropic Claude
- Excellent reasoning capabilities
- Great for complex codebases
- Requires API key
OpenAI:
- Go to platform.openai.com
- Create account and add billing method
- Generate API key in API Keys section
- Copy the key (starts with
sk-)
Anthropic:
- Go to console.anthropic.com
- Create account and add billing method
- Generate API key in API Keys section
- Copy the key (starts with
sk-ant-)
Ollama (Local):
- See our Ollama Setup Guide for complete instructions
# Navigate to a git repository
cd your-project
# Make some changes to your code
echo "console.log('Hello, coco!');" >> index.js
# Stage your changes
git add .# Generate commit message (stdout mode)
coco
# Or use interactive mode for review/editing
coco -i
# Or force conventional commits format
coco --conventionalStdout Mode (Default):
# Copy the generated message and commit manually
git commit -m "$(coco)"
# Or pipe directly
coco | git commit -F -Interactive Mode:
# Review, edit, and commit in one step
coco -i# 1. Make your changes
# ... edit files ...
# 2. Stage changes
git add .
# 3. Generate and commit
coco -i # Interactive mode for review
# Or for quick commits
git commit -m "$(coco)"# Enable conventional commits
coco --conventional
# Or set in config for always-on
{
"conventionalCommits": true
}
# Generates: "feat: add user authentication system"
# Instead of: "Add user authentication system"# Use project-specific config
coco init --scope project
# Commit the config file for team sharing
git add .coco.config.json
git commit -m "feat: add coco configuration for team"
# Team members can now use consistent settings# Basic commit generation
coco
# Interactive mode (recommended)
coco -i, --interactive
# Conventional commits format
coco -c, --conventional
# Add extra context
coco -a "Fixes login bug" --additional "Fixes login bug"
# Include commit history for context
coco -p 3 --with-previous-commits 3# Generate changelog
coco changelog
# Summarize recent changes
coco recap --yesterday
# Code review
coco review
# Help and options
coco --help
coco commit --help# Set interactive mode as default
export COCO_MODE=interactive
# Enable conventional commits
export COCO_CONVENTIONAL_COMMITS=true
# Set verbose output
export COCO_VERBOSE=trueCreate .coco.config.json in your project root:
{
"mode": "interactive",
"conventionalCommits": true,
"includeBranchName": true,
"service": {
"provider": "openai",
"model": "gpt-4o",
"authentication": {
"type": "APIKey",
"credentials": {
"apiKey": "your-api-key-here"
}
}
}
}# Set API key via environment variable
export OPENAI_API_KEY=sk-your-key-here
# Or run setup again
coco init# If installed globally, check PATH
npm list -g git-coco
# If installed locally, use npx
npx coco
# Or add to package.json scripts# Stage your changes first
git add .
# Or stage specific files
git add file1.js file2.js
# Then generate commit
coco# Add more context
coco --additional "Resolves issue with user login timeout"
# Include previous commits for context
coco --with-previous-commits 2
# Use interactive mode to edit
coco -i# Update commitlint packages
pnpm add -D @commitlint/config-conventional@latest @commitlint/cli@latest
# Or disable commitlint validation temporarily
coco --no-conventional- Read the Configuration Guide for detailed customization
- Set up Ollama for local, private AI
- Configure file ignoring for better focus
- Explore conventional commits for better project history
-
Share your
.coco.config.jsonwith your team - Set up git hooks for automated commit generation
- Integrate with CI/CD for consistent commit standards
- Train your team on conventional commits best practices
- Monitor API costs and optimize token usage
- Fine-tune prompts for your specific project needs
- Set up shortcuts and aliases for common workflows
- Integrate with your IDE for seamless development
- Configuration Guide - Complete configuration reference
- Ollama Setup - Local AI setup guide
- File Ignoring - Customize file processing
- GitHub Issues - Bug reports and feature requests
- Discord Community - Real-time help and discussion
- GitHub Discussions - Community Q&A
# Enable verbose output for debugging
coco --verbose commit
# Check current configuration
coco init --scope project
# Test API connectivity
curl -H "Authorization: Bearer $OPENAI_API_KEY" \
https://api.openai.com/v1/models- Start simple - Use default settings first, customize later
- Use interactive mode - Review and edit messages before committing
- Enable conventional commits - Better project history and automation
- Ignore irrelevant files - Focus on meaningful changes
-
Add context when needed - Use
--additionalfor complex changes - Share team config - Consistent commit styles across the team
Welcome to smarter, AI-powered git workflows with coco! 🚀