YOLO Mode
Master CommitStudio's YOLO mode for transforming cryptic commit messages into clear, professional documentation
How YOLO Mode Works
Behind the scenes, YOLO mode follows a sophisticated process:
-
Preparation
- Verifies that your working tree is clean to avoid losing uncommitted changes
- Identifies the commits to process based on your filtering criteria
- Extracts the diff content for each commit
-
AI Analysis
- For each commit, sends the code diff to the AI model
- Uses a specialized prompt that instructs the AI to:
- Analyze what changes were made
- Determine the purpose behind the changes
- Identify the key components affected
- Understand technical implications
-
Message Generation
- Generates clear, descriptive commit messages
- Structures messages with:
- A concise but informative summary line
- Detailed body explaining the changes
- Rationale for the changes when context is available
- Optionally adds appropriate emojis based on the content type
-
Git History Rewriting
- Uses Git's interactive rebase to modify commit messages
- Preserves all commit content and authorship information
- Maintains the same commit sequence and relationships
-
Results Presentation
- Shows before/after comparison for each message
- Provides guidance on pushing updated history
Before & After Examples
Before | After |
---|---|
fix bug | π Fix authentication timeout issue in login |
update UI | β¨ Update user dashboard with responsive design |
refactor | β»οΈ Refactor data pipeline for better performance |
WIP | π§ Implement user notification system |
typo | π Fix typos in API documentation |
When to Use YOLO Mode
YOLO mode is particularly valuable for:
- Legacy Projects: Improving historical documentation
- Before Public Release: Cleaning up commit history before open-sourcing
- Code Reviews: Making the review process more efficient with better context
- Knowledge Transfer: Helping new team members understand project history
- Documentation: Creating better release notes from commit logs
Command Options in Detail
commitstudio yolo [options]
Basic Options
-p, --path <path>
: Path to the git repository (default: current directory)-c, --commits <number>
: Number of commits to analyze (default: last 5)-b, --branch <branch>
: Branch to analyze (default: current branch)
Filtering Options
--since <date>
: Only analyze commits after this date (e.g., "2023-01-01")--author <email>
: Only analyze commits by this author--include-merge
: Include merge commits in the analysis (default: excluded)
Styling Options
--emoji
: Add contextually appropriate emojis to commit messages (default: on)--serious
: Generate professional messages without emojis--prefix <text>
: Add a custom prefix to each commit message
Execution Options
--dry-run
: Preview changes without modifying Git history--verbose
: Show detailed logs during processing--interactive
: Confirm each message change individually
How AI Generates Better Messages
The AI analyzes several aspects of your commit to generate improved messages:
-
Code Diff Analysis
- Identifies files modified, added, or deleted
- Examines specific code changes and patterns
- Recognizes language-specific constructs and features
-
Commit Type Detection
- Feature additions
- Bug fixes
- Performance improvements
- Refactoring
- Documentation changes
- Test additions
-
Technical Context Inference
- Component relationships
- Architectural patterns
- Common programming idioms
- Platform-specific considerations
-
Message Formatting Best Practices
- Follows the 50/72 rule (50 char title, 72 char body lines)
- Uses imperative present tense
- Starts with a clear action verb
- Provides supporting details in the body
Detailed Examples
Basic Usage
# Rewrite the last 5 commit messages with emojis
commitstudio yolo
Terminal output:
β Repository detected: username/project-name
β Working tree is clean
β Analyzing commits for rewriting...
β Generating improved commit messages...
1. Before: "fix login bug"
After: "π Fix user authentication timeout in login form"
2. Before: "add feature"
After: "β¨ Add multi-factor authentication with email verification"
3. Before: "cleanup"
After: "β»οΈ Remove deprecated authentication methods and refactor auth flow"
4. Before: "css updates"
After: "π Update login form styling with responsive design and dark mode support"
5. Before: "lint fix"
After: "π§Ή Fix ESLint warnings in authentication components"
? Apply these changes to your commit history? (Y/n) y
β Successfully rewrote commit messages!
Remember: You'll need to force push these changes with:
git push --force-with-lease
Advanced Usage
# Rewrite messages since January 1st by a specific author, without emojis
commitstudio yolo --since "2023-01-01" --author "dev@example.com" --serious --dry-run
Important Cautions
Git History Rewriting Considerations
YOLO mode uses git rebase -i
to rewrite commit messages, which changes commit hashes. This means:
-
Clean Working Tree Required: You must have a clean working tree (no uncommitted changes) before running YOLO mode. CommitStudio will check this and refuse to proceed if changes are detected.
-
Local-Only By Default: Changes are applied to your local repository only. You must explicitly push them to share with others.
-
Force Push Required: After running YOLO mode, you'll need to use
git push --force-with-lease
to update remote branches. Regular pushes will be rejected. -
Collaboration Impact: History rewriting can cause problems for collaborators who have based work on the original commits. Best practices:
- Only use on personal/feature branches
- Communicate with your team when using on shared branches
- Consider creating a backup branch before proceeding
-
CI/CD Considerations: History rewrites may trigger new CI/CD runs for the same code
Integration with Development Workflow
YOLO mode integrates best with these workflows:
-
Feature Branch Cleanup:
- Develop on a feature branch
- Before creating a PR, run YOLO mode
- Force push the improved history
- Create a clean, professional PR
-
Personal Repository Management:
- Run periodically on your repositories
- Creates a cleaner project history
- Makes release notes generation easier
-
Pre-Tag Cleanup:
- Before creating version tags
- Ensures release history is professional
- Improves documentation for releases
Related Topics
- Standard Mode - Learn about CommitStudio's main analysis mode
- Configuration Options - Customize AI models for better messages
- Git Workflows - Integrate CommitStudio into your workflow