lazypr

CLI Usage

Command-line usage patterns from basic to advanced

Basic Usage

The simplest way to use LazyPR is to run it in your repository:

lazypr

This analyzes commits between your current branch and main, generates a professional title and description, and offers to copy the result to your clipboard.

Branch Targeting

Specify a different target branch to compare against:

lazypr develop     # Compare against develop
lazypr production  # Compare against production
lazypr release-v2  # Compare against release branch

Using PR Templates

LazyPR automatically searches for templates in standard locations:

  • .github/pull_request_template.md
  • .github/PULL_REQUEST_TEMPLATE/

Enable template usage with the --template flag:

lazypr main --template

If multiple templates exist, LazyPR shows an interactive selector.

Common Workflows

Generate and copy to clipboard immediately:

lazypr main
# Select "Copy to clipboard" when prompted

Save to a file for review before using:

lazypr main > pr-description.txt
# Review and edit pr-description.txt
# Then create PR manually

Create a git alias for faster access:

git config --global alias.pr '!lazypr'
# Now use: git pr main

Advanced Options

Commit Filtering

By default, LazyPR filters out merge commits, dependency updates, and formatting changes to focus on meaningful content:

# Include all commits without filtering
lazypr main --no-filter

Locale Support

Generate PR descriptions in multiple languages:

lazypr main -l es  # Spanish
lazypr main -l fr  # French
lazypr main -l ja  # Japanese
lazypr main -l de  # German
lazypr main -l zh  # Chinese
lazypr main -l pt  # Portuguese
lazypr main -l ru  # Russian
lazypr main -l ko  # Korean

Custom Models

Switch between providers and models for different use cases:

# Default model
lazypr main --provider groq

# Specify model
lazypr config set MODEL=llama-3.3-70b-versatile
lazypr config set MODEL=llama-3.1-8b-instant  # Faster
lazypr main --provider cerebras

Adding Context

Guide the AI with additional context about your PR:

# Explain the purpose
lazypr main -c "This PR fixes a critical security vulnerability"

# Note breaking changes
lazypr main -c "Breaking change: API v1 is deprecated"

# Specify audience
lazypr main -c "Written for external contributors"

Context is limited to 200 characters. Use it for high-level guidance.

Scripting & Automation

Output Redirection

Save output directly to a file:

lazypr main > pr.txt

Conditional Generation

Only generate if there are commits to process:

if git log main..HEAD --oneline | grep -q .; then
  lazypr main
fi

Batch Processing

Process multiple branches:

for branch in feature/auth feature/api feature/ui; do
  git checkout "$branch"
  lazypr main > "pr-${branch##*/}.txt"
done

Multiple Templates

Organize templates by PR type in .github/PULL_REQUEST_TEMPLATE/:

.github/
  PULL_REQUEST_TEMPLATE/
    feature.md
    bugfix.md
    hotfix.md
    release.md

When using --template, LazyPR will prompt you to select the appropriate template.

Git Hooks Integration

Pre-push Hook

Auto-generate PR description before pushing:

# .git/hooks/pre-push
#!/bin/bash
if [[ $(git rev-parse --abbrev-ref HEAD) != "main" ]]; then
  lazypr main > .pr-description.txt
  echo "PR description saved to .pr-description.txt"
fi

Prepare-commit-msg Hook

Add PR-ready summaries to commits:

# .git/hooks/prepare-commit-msg
#!/bin/bash
# Only for feature branches
if [[ $(git rev-parse --abbrev-ref HEAD) == feature/* ]]; then
  # Your hook logic here
fi

Troubleshooting

"Not a git repository"

Make sure you're inside a git repository:

git status  # Should not error

"No commits found"

Your branch needs commits that differ from the target:

git log main..HEAD --oneline  # Should show commits

API Key Issues

Verify your API key is configured:

lazypr config list  # Check GROQ_API_KEY or CEREBRAS_API_KEY

Rate Limiting

If you hit rate limits, wait a few minutes or switch providers:

lazypr main --provider cerebras  # Try alternate provider

On this page