Skip to content

Instantly share code, notes, and snippets.

@jorgecolonconsulting
Last active March 7, 2025 21:10
Show Gist options
  • Save jorgecolonconsulting/658d07e5a51cf5515a2dd9aa1c690ebb to your computer and use it in GitHub Desktop.
Save jorgecolonconsulting/658d07e5a51cf5515a2dd9aa1c690ebb to your computer and use it in GitHub Desktop.
Include as context along with your prompt in agent mode (cascade/builder mode) `@git-analyze-history.md give me a summary of the past 3 commits`

Task

Analyze git commit history

Usage Instructions

  1. Specify the number of commits to analyze (default: 2)
  2. Execute the analysis command:
    git diff HEAD~[N] HEAD -- . ':(exclude)*.lock' | cat

Best Practices

  • EXTREMELY IMPORTANT: Use single quotes for pattern matching (eg. git diff HEAD~2 HEAD -- . ':(exclude)*.lock' | cat)
  • DO NOT OUTPUT pathspec patterns WITHOUT single quotes (eg. git diff HEAD~2 HEAD -- . :(exclude)*.lock | cat)
  • Exclude lock files from analysis

Example Scenarios

Prompt: Review the last 3 commits for code quality improvements Command:

git diff HEAD~3 HEAD -- . ':(exclude)*.lock' | cat

Prompt: Analyze the last 5 commits for potential bug sources Command:

git diff HEAD~5 HEAD -- . ':(exclude)*.lock' | cat

Prompt: Provide an overview of recent code changes Command:

git diff HEAD~2 HEAD -- . ':(exclude)*.lock' | cat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment