Overview
Forge’s git integration:- Generates commit messages from staged changes
- Creates pull request descriptions with context
- Resolves merge conflicts with AI assistance
- Analyzes branch changes for comprehensive reviews
- Follows conventions like Conventional Commits
Key Benefit
Never write another generic “fix stuff” commit message. Forge analyzes your changes and generates descriptive, conventional commit messages automatically.
Commit Message Generation
Basic Usage
- ZSH Plugin
- CLI Command
- From Diff
How It Works
When you generate a commit message, Forge:-
Captures context:
- Staged or unstaged changes (git diff)
- Current branch name
- Recent commit messages (last 20)
- Additional context if provided
-
Analyzes changes:
- Identifies modified files and functions
- Understands the nature of changes
- Recognizes patterns (feature, fix, refactor)
-
Generates message:
- Follows Conventional Commits format
- Summarizes changes concisely
- Focuses on “why” not just “what”
- Adapts to your project’s style
-
Commits properly:
- Sets you as the author (from git config)
- Sets ForgeCode as the committer
- Properly attributes the commit to both
Commit Format
Forge generates commits following Conventional Commits:Configuration
Control commit message generation:- Large diffs can exceed model context limits
- Truncation focuses on most important changes
- Improves generation speed and quality
Adding Context
Provide additional context for better messages:Pull Request Workflows
Creating Pull Requests
Forge integrates with GitHub CLI (gh) for PR creation:
- Analyze all commits since branching from main/master
- Review the full diff of changes
- Generate comprehensive PR description
- Create the PR using
gh pr create
PR Description Format
Updating PR Descriptions
Use custom commands to update PR descriptions:- Analyzes current PR changes
- Generates updated description
- Updates the PR using
ghCLI
Merge Conflict Resolution
Get AI assistance with merge conflicts:- Interactive Resolution
- Explain Conflicts
- Analyze both versions
- Understand the conflicting changes
- Suggest resolution strategy
- Explain trade-offs
Branch Analysis
Analyze branch changes before merging:Git Workflow Patterns
Feature Development
Bug Fixes
Refactoring
Advanced Features
Commit Attribution
Forge properly sets git authorship:- Author: Who wrote the changes (you)
- Committer: Who created the commit (ForgeCode)
Co-authored Commits
For team workflows, include co-authors:Working with Staged vs Unstaged
Forge intelligently handles both:Diff Truncation
For large changes:Git Commands Reference
Best Practices
Troubleshooting
No changes to commit error
No changes to commit error
Generated message is too generic
Generated message is too generic
- Provide additional context with
--additional-context - Make more focused, atomic commits
- Check that meaningful changes are staged
- Verify diff is not truncated too aggressively
Commit fails with git error
Commit fails with git error
PR creation fails
PR creation fails
- Install GitHub CLI:
brew install gh - Authenticate:
gh auth login - Verify you’re in a git repository with remote
- Check you’re on a branch (not detached HEAD)
Integration Examples
With Custom Commands
Create a complete git workflow command:With Shell Integration
Streamlined git workflow:Related Features
- Shell Integration - Git operations via
:commands - Custom Commands - Automate git workflows
- Multi-Agent Workflows - Orchestrate complex git operations