Git Analysis This Skill provides comprehensive git repository analysis capabilities for understanding branch changes, commit history, and code differences. Capabilities - Analyze branch differences and merge bases - Extract structured commit history - Identify changed files and their statistics - Determine default branches and remote configuration - Support PR creation, code review, and commit operations When to Use Use this Skill when you need to: - Analyze what changed in a branch - Prepare information for PR creation - Review commit history - Compare branches - Understand code changes for…

\\t' read status file; do\n case $status in\n A) operation=\"Added\" ;;\n M) operation=\"Modified\" ;;\n D) operation=\"Deleted\" ;;\n R*) operation=\"Renamed\" ;;\n C*) operation=\"Copied\" ;;\n *) operation=\"Unknown\" ;;\n esac\n\n extension=\"${file##*.}\"\n echo \"$operation: $file (.$extension)\"\ndone | sort\n\necho \"\"\necho \"Summary by file type:\"\ngit diff --name-only $MERGE_BASE..HEAD | awk -F. '{print $NF}' | sort | uniq -c | sort -rn\n```\n\n## Performance Optimization\n\n### Efficient Commands\n\n#### Use Plumbing Commands\nPlumbing commands are faster for scripting:\n```bash\n# Instead of: git branch --show-current\ngit rev-parse --abbrev-ref HEAD\n\n# Instead of: git status\ngit diff-index --quiet HEAD -- || echo \"Changes detected\"\n```\n\n#### Limit Output\n```bash\n# Limit commit history depth\ngit log --max-count=10 \u003cmerge-base>..HEAD\n\n# Limit diff context\ngit diff --unified=1 \u003cmerge-base>..HEAD\n\n# Shallow clone for analysis\ngit clone --depth=1 --single-branch \u003curl>\n```\n\n#### Parallel Execution\nRun independent git commands in parallel using background jobs (`&`) and `wait`.\n\n### Caching Results\n```bash\n# Cache expensive operations\nif [ ! -f .git/cached_merge_base ]; then\n git merge-base origin/main HEAD > .git/cached_merge_base\nfi\nMERGE_BASE=$(cat .git/cached_merge_base)\n```\n\n## Error Handling\n\n### Common Errors\n\n#### Not in Git Repository\n```bash\nif ! git rev-parse --git-dir > /dev/null 2>&1; then\n echo \"Error: Not in a git repository\" >&2\n exit 1\nfi\n```\n\n#### Remote Not Found\n```bash\nif ! git ls-remote origin > /dev/null 2>&1; then\n echo \"Error: Remote 'origin' not found\" >&2\n exit 1\nfi\n```\n\n#### No Commits in Branch\n```bash\nMERGE_BASE=$(git merge-base origin/main HEAD)\nif [ -z \"$(git log --oneline $MERGE_BASE..HEAD)\" ]; then\n echo \"Warning: No commits in current branch\" >&2\nfi\n```\n\n#### Detached HEAD\n```bash\nif ! git symbolic-ref HEAD > /dev/null 2>&1; then\n echo \"Warning: In detached HEAD state\" >&2\nfi\n```\n\n### Robust Script Template\n```bash\n#!/usr/bin/env bash\nset -euo pipefail\n\n# Error handler\nerror_exit() {\n echo \"Error: $1\" >&2\n exit 1\n}\n\n# Check prerequisites\ngit rev-parse --git-dir > /dev/null 2>&1 || error_exit \"Not in a git repository\"\ngit ls-remote origin > /dev/null 2>&1 || error_exit \"Remote 'origin' not found\"\n\n# Get branch info safely\nDEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@') || \\\n error_exit \"Could not determine default branch\"\n\nMERGE_BASE=$(git merge-base origin/\"$DEFAULT_BRANCH\" HEAD 2>/dev/null) || \\\n error_exit \"Could not determine merge base\"\n\n# Continue with analysis...\n```\n\n## Integration Tips\n\n### With PR Creation\n```bash\n# Extract all info needed for PR\nDEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')\nMERGE_BASE=$(git merge-base origin/$DEFAULT_BRANCH HEAD)\n\n# Get commits for PR description\ngit log --format=\"- %s\" $MERGE_BASE..HEAD\n\n# Get changed files for context\ngit diff --name-only $MERGE_BASE..HEAD\n```\n\n### With Commit Message Generation\n```bash\n# Analyze staged changes\ngit diff --cached --name-status\n\n# Get context from recent commits\ngit log --oneline -5\n\n# Identify scope from changed files\ngit diff --cached --name-only | awk -F/ '{print $1}' | sort | uniq\n```\n\n### With Code Review\n```bash\n# Get files to review\ngit diff --name-only origin/main..HEAD\n\n# Get detailed changes per file\ngit diff origin/main..HEAD -- \u003cfile>\n\n# Get commits introducing changes\ngit log origin/main..HEAD -- \u003cfile>\n```\n\n## Related Resources\n\n- [Git Documentation](https://git-scm.com/doc)\n- [Git Manual Pages](https://git-scm.com/docs)\n- [Pro Git Book](https://git-scm.com/book/en/v2)\n","content_type":"text/markdown; charset=utf-8","language":"markdown","size":10282,"content_sha256":"a4b33b9feab18f718aafb9611aa1ca2b7374ebce92d12307686e0a31de21c5f1"},{"filename":"scripts/get_branch_diff.sh","content":"#!/usr/bin/env bash\n#\n# get_branch_diff.sh\n#\n# Extracts branch differences including default branch, merge base,\n# commit count, and changed files summary.\n#\n# Usage: bash get_branch_diff.sh\n#\n# Output format:\n# DEFAULT_BRANCH: main\n# MERGE_BASE: abc123def456\n# COMMITS: 5\n# CHANGED_FILES: 12\n# INSERTIONS: 234\n# DELETIONS: 89\n\nset -euo pipefail\n\n# Check if in git repository\nif ! git rev-parse --git-dir > /dev/null 2>&1; then\n echo \"Error: Not in a git repository\" >&2\n exit 1\nfi\n\n# Get default branch\nDEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@' || echo \"main\")\n\n# Get merge base\nMERGE_BASE=$(git merge-base origin/\"$DEFAULT_BRANCH\" HEAD 2>/dev/null || echo \"\")\n\nif [ -z \"$MERGE_BASE\" ]; then\n echo \"Error: Could not determine merge base\" >&2\n exit 1\nfi\n\n# Get commit count\nCOMMIT_COUNT=$(git log --oneline \"$MERGE_BASE\"..HEAD | wc -l | tr -d ' ')\n\n# Get file statistics\nSTATS=$(git diff --shortstat \"$MERGE_BASE\"..HEAD)\n\n# Extract changed files, insertions, deletions\nif [ -n \"$STATS\" ]; then\n CHANGED_FILES=$(echo \"$STATS\" | grep -oE '[0-9]+ file' | grep -oE '[0-9]+' || echo \"0\")\n INSERTIONS=$(echo \"$STATS\" | grep -oE '[0-9]+ insertion' | grep -oE '[0-9]+' || echo \"0\")\n DELETIONS=$(echo \"$STATS\" | grep -oE '[0-9]+ deletion' | grep -oE '[0-9]+' || echo \"0\")\nelse\n CHANGED_FILES=\"0\"\n INSERTIONS=\"0\"\n DELETIONS=\"0\"\nfi\n\n# Output structured data\necho \"DEFAULT_BRANCH: $DEFAULT_BRANCH\"\necho \"MERGE_BASE: $MERGE_BASE\"\necho \"COMMITS: $COMMIT_COUNT\"\necho \"CHANGED_FILES: $CHANGED_FILES\"\necho \"INSERTIONS: $INSERTIONS\"\necho \"DELETIONS: $DELETIONS\"\n","content_type":"application/x-sh; charset=utf-8","language":"bash","size":1649,"content_sha256":"79a55b23a72a5c3b00664d0cdd6a5985532eec2519ce9c734407a4ed42e6437a"},{"filename":"scripts/get_commit_history.sh","content":"#!/usr/bin/env bash\n#\n# get_commit_history.sh\n#\n# Extracts detailed commit history in structured format from merge base to HEAD.\n#\n# Usage: bash get_commit_history.sh [merge-base]\n#\n# If merge-base is not provided, it will be automatically determined.\n#\n# Output format (one commit per line):\n# hash|subject|author_name|author_email|date\n\nset -euo pipefail\n\n# Check if in git repository\nif ! git rev-parse --git-dir > /dev/null 2>&1; then\n echo \"Error: Not in a git repository\" >&2\n exit 1\nfi\n\nMERGE_BASE=\"$1\"\n\n# If merge base not provided, determine it automatically\nif [ -z \"$MERGE_BASE\" ]; then\n DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@' || echo \"main\")\n MERGE_BASE=$(git merge-base origin/\"$DEFAULT_BRANCH\" HEAD 2>/dev/null || echo \"\")\n\n if [ -z \"$MERGE_BASE\" ]; then\n echo \"Error: Could not determine merge base\" >&2\n exit 1\n fi\nfi\n\n# Get structured commit history\n# Format: hash|subject|author_name|author_email|date\ngit log --format=\"%H|%s|%an|%ae|%ad\" --date=iso \"$MERGE_BASE\"..HEAD\n","content_type":"application/x-sh; charset=utf-8","language":"bash","size":1088,"content_sha256":"e3d0ba51d5985312cfdbeb3ad4f88ca2b2895c23b0f9dd490408758e715acf2a"},{"filename":"skill-report.json","content":"{\n \"schema_version\": \"2.0\",\n \"meta\": {\n \"generated_at\": \"2026-01-16T14:19:08.628Z\",\n \"slug\": \"1natsu172-git-analysis\",\n \"source_url\": \"https://github.com/1natsu172/dotfiles/tree/master/.claude/skills/git-analysis\",\n \"source_ref\": \"master\",\n \"model\": \"claude\",\n \"analysis_version\": \"3.0.0\",\n \"source_type\": \"community\",\n \"content_hash\": \"f415b21ad5bbc3269e62f19055433758e3cce08873411691678a4fdaaa874827\",\n \"tree_hash\": \"2dc726058788800af160e35b0e1ceadd22d9fd30e4df6690bb0dc4659b030afe\"\n },\n \"skill\": {\n \"name\": \"git-analysis\",\n \"description\": \"Analyze git repository changes, branch differences, and commit history. Use when analyzing branches, comparing changes, examining commit history, or preparing for PR/commit operations.\",\n \"summary\": \"Analyze git repository changes, branch differences, and commit history. Use when analyzing branches,...\",\n \"icon\": \"🔀\",\n \"version\": \"1.0.0\",\n \"author\": \"1natsu172\",\n \"license\": \"MIT\",\n \"category\": \"coding\",\n \"tags\": [\n \"git\",\n \"repository\",\n \"analysis\",\n \"version-control\",\n \"branches\"\n ],\n \"supported_tools\": [\n \"claude\",\n \"codex\",\n \"claude-code\"\n ],\n \"risk_factors\": [\n \"scripts\",\n \"external_commands\"\n ]\n },\n \"security_audit\": {\n \"risk_level\": \"safe\",\n \"is_blocked\": false,\n \"safe_to_publish\": true,\n \"summary\": \"This is a legitimate git analysis tool containing standard shell scripts for git repository operations. All 183 static findings are false positives. The 'weak cryptographic algorithm' HIGH findings were triggered by YAML/JSON metadata fields and git format specifiers that the scanner misidentified. All external command patterns are necessary git commands (git log, git diff, git merge-base) for read-only repository analysis. No network calls, credential theft, or malicious code exists. This skill only performs read operations on local git repositories.\",\n \"risk_factor_evidence\": [\n {\n \"factor\": \"scripts\",\n \"evidence\": [\n {\n \"file\": \"scripts/get_branch_diff.sh\",\n \"line_start\": 1,\n \"line_end\": 61\n },\n {\n \"file\": \"scripts/get_commit_history.sh\",\n \"line_start\": 1,\n \"line_end\": 38\n }\n ]\n },\n {\n \"factor\": \"external_commands\",\n \"evidence\": [\n {\n \"file\": \"REFERENCE.md\",\n \"line_start\": 1,\n \"line_end\": 450\n },\n {\n \"file\": \"SKILL.md\",\n \"line_start\": 1,\n \"line_end\": 224\n }\n ]\n }\n ],\n \"critical_findings\": [],\n \"high_findings\": [],\n \"medium_findings\": [],\n \"low_findings\": [],\n \"dangerous_patterns\": [],\n \"files_scanned\": 5,\n \"total_lines\": 1002,\n \"audit_model\": \"claude\",\n \"audited_at\": \"2026-01-16T14:19:08.628Z\"\n },\n \"content\": {\n \"user_title\": \"Analyze git branches and commits\",\n \"value_statement\": \"Understanding git repository changes requires running multiple commands and parsing output. This skill automates branch analysis, commit history extraction, and file change statistics for faster code review and PR preparation.\",\n \"seo_keywords\": [\n \"git analysis\",\n \"branch comparison\",\n \"commit history\",\n \"git diff\",\n \"merge base\",\n \"Claude\",\n \"Codex\",\n \"Claude Code\",\n \"version control\",\n \"code review\"\n ],\n \"actual_capabilities\": [\n \"Find merge base between branches\",\n \"Extract structured commit history with statistics\",\n \"Identify changed files and line change counts\",\n \"Get default branch and remote configuration\",\n \"Generate branch comparison reports\"\n ],\n \"limitations\": [\n \"Only works with local git repositories\",\n \"Requires git to be installed and available\",\n \"Cannot analyze remote repository history directly\",\n \"Does not modify or create commits\"\n ],\n \"use_cases\": [\n {\n \"target_user\": \"Developers\",\n \"title\": \"Code review preparation\",\n \"description\": \"Extract branch changes and commit history for code review discussions\"\n },\n {\n \"target_user\": \"PR creators\",\n \"title\": \"PR description generation\",\n \"description\": \"Gather commit lists and file changes for pull request descriptions\"\n },\n {\n \"target_user\": \"Team leads\",\n \"title\": \"Change tracking\",\n \"description\": \"Monitor branch activity and track what changed between branches\"\n }\n ],\n \"prompt_templates\": [\n {\n \"title\": \"Basic branch analysis\",\n \"scenario\": \"Show current branch differences\",\n \"prompt\": \"Analyze the current branch and show what commits and files have changed compared to the default branch\"\n },\n {\n \"title\": \"Commit history extraction\",\n \"scenario\": \"Get detailed commit log\",\n \"prompt\": \"Extract the commit history from the merge base to HEAD in structured format with author and date information\"\n },\n {\n \"title\": \"File change summary\",\n \"scenario\": \"Summarize modified files\",\n \"prompt\": \"Show how many files changed, insertions, and deletions in the current branch\"\n },\n {\n \"title\": \"Full analysis report\",\n \"scenario\": \"Complete branch report\",\n \"prompt\": \"Provide a complete analysis of the current branch including default branch, merge base, commit count, and detailed change statistics\"\n }\n ],\n \"output_examples\": [\n {\n \"input\": \"Analyze the current branch and show what changed compared to main\",\n \"output\": [\n \"Branch Analysis Summary\",\n \"Base branch: main\",\n \"Current branch: feature/new-feature\",\n \"Merge base: abc123d (2025-01-15)\",\n \"Changes:\",\n \"- 5 commits ahead\",\n \"- 12 files changed\",\n \"- 234 insertions, 89 deletions\",\n \"Recent commits:\",\n \"1. feat(api): add new endpoint\",\n \"2. test(api): add endpoint tests\",\n \"3. docs(api): update API documentation\"\n ]\n },\n {\n \"input\": \"Show me the structured commit history\",\n \"output\": [\n \"abc123|feat(api): add endpoint|John Doe|[email protected]|2025-01-16\",\n \"def456|test(api): add tests|Jane Smith|[email protected]|2025-01-16\",\n \"ghi789|docs(api): update docs|Bob Wilson|[email protected]|2025-01-17\"\n ]\n },\n {\n \"input\": \"Get a summary of changed files\",\n \"output\": [\n \"DEFAULT_BRANCH: main\",\n \"MERGE_BASE: abc123def\",\n \"COMMITS: 5\",\n \"CHANGED_FILES: 12\",\n \"INSERTIONS: 234\",\n \"DELETIONS: 89\"\n ]\n }\n ],\n \"best_practices\": [\n \"Always use merge base for comparison instead of current branch state\",\n \"Run independent git commands in parallel for faster results\",\n \"Structure output in consistent format for easier parsing\"\n ],\n \"anti_patterns\": [\n \"Comparing from branch tip instead of merge base\",\n \"Running commands sequentially when parallel execution is possible\",\n \"Ignoring error messages from git commands\"\n ],\n \"faq\": [\n {\n \"question\": \"Which git versions are supported?\",\n \"answer\": \"Works with git 2.0 and above. Most modern systems have compatible versions.\"\n },\n {\n \"question\": \"What is the maximum commit count for analysis?\",\n \"answer\": \"No hard limit. Performance depends on repository size and git command efficiency.\"\n },\n {\n \"question\": \"Can this skill create or modify commits?\",\n \"answer\": \"No. This skill only analyzes existing repository state. Use other tools for commit operations.\"\n },\n {\n \"question\": \"Is my repository data safe?\",\n \"answer\": \"Yes. This tool only reads repository data using standard git read-only commands.\"\n },\n {\n \"question\": \"What if merge base cannot be determined?\",\n \"answer\": \"The scripts will show an error message and exit. Ensure you are on a branch with commits.\"\n },\n {\n \"question\": \"How is this different from git log?\",\n \"answer\": \"This skill provides structured output and combines multiple git commands for comprehensive analysis.\"\n }\n ]\n },\n \"file_structure\": [\n {\n \"name\": \"scripts\",\n \"type\": \"dir\",\n \"path\": \"scripts\",\n \"children\": [\n {\n \"name\": \"get_branch_diff.sh\",\n \"type\": \"file\",\n \"path\": \"scripts/get_branch_diff.sh\",\n \"lines\": 61\n },\n {\n \"name\": \"get_commit_history.sh\",\n \"type\": \"file\",\n \"path\": \"scripts/get_commit_history.sh\",\n \"lines\": 38\n }\n ]\n },\n {\n \"name\": \"REFERENCE.md\",\n \"type\": \"file\",\n \"path\": \"REFERENCE.md\",\n \"lines\": 453\n },\n {\n \"name\": \"SKILL.md\",\n \"type\": \"file\",\n \"path\": \"SKILL.md\",\n \"lines\": 224\n }\n ]\n}\n","content_type":"application/json; charset=utf-8","language":"json","size":9069,"content_sha256":"5f90391f926f8c1a03bac7587ac3fcd967030fece1a451ee45f236f0676f71d3"}],"content_json":{"type":"doc","content":[{"type":"heading","attrs":{"level":1},"content":[{"text":"Git Analysis","type":"text"}]},{"type":"paragraph","content":[{"text":"This Skill provides comprehensive git repository analysis capabilities for understanding branch changes, commit history, and code differences.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Capabilities","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Analyze branch differences and merge bases","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Extract structured commit history","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Identify changed files and their statistics","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Determine default branches and remote configuration","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Support PR creation, code review, and commit operations","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"When to Use","type":"text"}]},{"type":"paragraph","content":[{"text":"Use this Skill when you need to:","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Analyze what changed in a branch","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Prepare information for PR creation","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Review commit history","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Compare branches","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Understand code changes for commits or reviews","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Core Analysis Steps","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"1. Identify Default Branch","type":"text"}]},{"type":"paragraph","content":[{"text":"Get the repository's default branch (usually ","type":"text"},{"text":"main","type":"text","marks":[{"type":"code_inline"}]},{"text":" or ","type":"text"},{"text":"master","type":"text","marks":[{"type":"code_inline"}]},{"text":"):","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@'","type":"text"}]},{"type":"paragraph","content":[{"text":"This identifies the base branch for comparison.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"2. Find Merge Base","type":"text"}]},{"type":"paragraph","content":[{"text":"Determine where the current branch diverged from the default branch:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Get merge base\ngit merge-base origin/\u003cdefault-branch> HEAD","type":"text"}]},{"type":"paragraph","content":[{"text":"The merge base is the commit where the branch diverged, not the current state of the base branch.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"3. Analyze Changes","type":"text"}]},{"type":"paragraph","content":[{"text":"Get comprehensive change information:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# List commits from merge base\ngit log --oneline \u003cmerge-base>..HEAD\n\n# Get detailed commit information\ngit log --format=\"%H|%s|%an|%ae|%ad\" --date=iso \u003cmerge-base>..HEAD\n\n# Get file statistics\ngit diff --stat \u003cmerge-base>..HEAD\n\n# Get full diff\ngit diff \u003cmerge-base>..HEAD","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"4. Check Current State","type":"text"}]},{"type":"paragraph","content":[{"text":"Understand unstaged and staged changes:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Check untracked files\ngit status\n\n# Check staged changes\ngit diff --cached\n\n# Check unstaged changes\ngit diff","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Helper Scripts","type":"text"}]},{"type":"paragraph","content":[{"text":"This Skill includes helper scripts for common operations:","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"get_branch_diff.sh","type":"text"}]},{"type":"paragraph","content":[{"text":"Extracts branch differences including:","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Default branch name","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Merge base commit","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Commit list with statistics","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Changed files summary","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"Usage:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"bash scripts/get_branch_diff.sh","type":"text"}]},{"type":"paragraph","content":[{"text":"Output format:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":""},"content":[{"text":"DEFAULT_BRANCH: main\nMERGE_BASE: abc123def456\nCOMMITS: 5\nCHANGED_FILES: 12","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"get_commit_history.sh","type":"text"}]},{"type":"paragraph","content":[{"text":"Extracts detailed commit history in structured format:","type":"text"}]},{"type":"paragraph","content":[{"text":"Usage:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"bash scripts/get_commit_history.sh \u003cmerge-base>","type":"text"}]},{"type":"paragraph","content":[{"text":"Output format (one commit per line):","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":""},"content":[{"text":"hash|subject|author_name|author_email|date","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Best Practices","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Always use merge-base","type":"text","marks":[{"type":"strong"}]},{"text":": Compare from merge base, not from current base branch state","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Run commands in parallel","type":"text","marks":[{"type":"strong"}]},{"text":": When gathering multiple pieces of information, run independent git commands in parallel","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Structure the output","type":"text","marks":[{"type":"strong"}]},{"text":": Parse git output into structured data for easier consumption","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Handle errors gracefully","type":"text","marks":[{"type":"strong"}]},{"text":": Check if commands succeed before proceeding","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Common Patterns","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Pattern 1: Full Branch Analysis","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Get all information in parallel\ngit status &\ngit diff --cached &\ngit diff &\nDEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')\nMERGE_BASE=$(git merge-base origin/$DEFAULT_BRANCH HEAD)\ngit log --oneline $MERGE_BASE..HEAD\ngit diff --stat $MERGE_BASE..HEAD\nwait","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Pattern 2: Commit History Extraction","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Get structured commit data\nMERGE_BASE=$(git merge-base origin/$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@') HEAD)\ngit log --format=\"%H|%s|%an|%ae|%ad\" --date=iso $MERGE_BASE..HEAD","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Pattern 3: Change Summary","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Get high-level change summary\nMERGE_BASE=$(git merge-base origin/$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@') HEAD)\necho \"Commits: $(git log --oneline $MERGE_BASE..HEAD | wc -l)\"\necho \"Files changed: $(git diff --stat $MERGE_BASE..HEAD | tail -1)\"","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Integration with Other Skills","type":"text"}]},{"type":"paragraph","content":[{"text":"This Skill works well with:","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"github-pr-best-practices","type":"text","marks":[{"type":"code_inline"}]},{"text":": Use git analysis results to generate PR content","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Commit message generation: Analyze changes to create meaningful commit messages","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Code review: Understand what changed for review purposes","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Error Handling","type":"text"}]},{"type":"paragraph","content":[{"text":"Handle common git errors:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Check if in git repository\nif ! git rev-parse --git-dir > /dev/null 2>&1; then\n echo \"Error: Not in a git repository\"\n exit 1\nfi\n\n# Check if remote exists\nif ! git ls-remote origin > /dev/null 2>&1; then\n echo \"Error: Remote 'origin' not found\"\n exit 1\nfi\n\n# Check if branch has commits\nif [ -z \"$(git log --oneline $MERGE_BASE..HEAD)\" ]; then\n echo \"Warning: No commits found in branch\"\nfi","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Output Format Recommendations","type":"text"}]},{"type":"paragraph","content":[{"text":"When presenting git analysis results:","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Summary first","type":"text","marks":[{"type":"strong"}]},{"text":": Start with high-level statistics","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Structured data","type":"text","marks":[{"type":"strong"}]},{"text":": Use consistent formatting for easy parsing","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Contextual information","type":"text","marks":[{"type":"strong"}]},{"text":": Include branch names and dates","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Actionable insights","type":"text","marks":[{"type":"strong"}]},{"text":": Highlight what's important for the task","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"Example output structure:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":""},"content":[{"text":"Branch Analysis Summary\n-----------------------\nBase branch: main\nCurrent branch: feature/new-feature\nDiverged at: abc123d (2025-01-15)\n\nChanges:\n- 5 commits\n- 12 files changed\n- 234 insertions, 89 deletions\n\nRecent commits:\n1. feat(api): add new endpoint (2025-01-16)\n2. test(api): add endpoint tests (2025-01-16)\n3. docs(api): update API documentation (2025-01-17)\n...","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Related Git Commands Reference","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"See ","type":"text"},{"text":"REFERENCE.md","type":"text","marks":[{"type":"link","attrs":{"href":"REFERENCE.md","title":null}}]},{"text":" for detailed git command documentation and advanced usage patterns.","type":"text"}]}]},"metadata":{"date":"2026-06-05","name":"git-analysis","author":"@skillopedia","source":{"stars":336,"repo_name":"marketplace","origin_url":"https://github.com/aiskillstore/marketplace/blob/HEAD/skills/1natsu172/git-analysis/SKILL.md","repo_owner":"aiskillstore","body_sha256":"ca6f4ca01908873dc2e017f20bc81ebd1d21e7ce83f3dbb887311df514d7072d","cluster_key":"d5161c0cc6ad4cc57bc5d581552970dd3e5f67de32392a49b39725352922fd8a","clean_bundle":{"format":"clean-skill-bundle-v1","source":"aiskillstore/marketplace/skills/1natsu172/git-analysis/SKILL.md","attachments":[{"id":"ab77b1f7-0ae0-5005-9785-26d06c8c5ad0","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/ab77b1f7-0ae0-5005-9785-26d06c8c5ad0/attachment.md","path":"REFERENCE.md","size":10282,"sha256":"a4b33b9feab18f718aafb9611aa1ca2b7374ebce92d12307686e0a31de21c5f1","contentType":"text/markdown; charset=utf-8"},{"id":"afb44b94-6cef-596e-96ff-f0ea8a6231a6","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/afb44b94-6cef-596e-96ff-f0ea8a6231a6/attachment.sh","path":"scripts/get_branch_diff.sh","size":1649,"sha256":"79a55b23a72a5c3b00664d0cdd6a5985532eec2519ce9c734407a4ed42e6437a","contentType":"application/x-sh; charset=utf-8"},{"id":"4c8d1104-bc63-588a-bff7-5662027f9a83","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/4c8d1104-bc63-588a-bff7-5662027f9a83/attachment.sh","path":"scripts/get_commit_history.sh","size":1088,"sha256":"e3d0ba51d5985312cfdbeb3ad4f88ca2b2895c23b0f9dd490408758e715acf2a","contentType":"application/x-sh; charset=utf-8"},{"id":"f532db54-6568-54bd-8db3-4cfa045d9bae","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/f532db54-6568-54bd-8db3-4cfa045d9bae/attachment.json","path":"skill-report.json","size":9069,"sha256":"5f90391f926f8c1a03bac7587ac3fcd967030fece1a451ee45f236f0676f71d3","contentType":"application/json; charset=utf-8"}],"bundle_sha256":"6cd29764d3cc258580efab3af3a8fb06f4f009985349a722dc43b34c2cf4cff7","attachment_count":4,"text_attachments":4,"attachment_storage":"skillopedia-attachments-v1","binary_attachments":0,"excluded_attachments":[]},"cluster_size":1,"skill_md_path":"skills/1natsu172/git-analysis/SKILL.md","import_metadata":{"date":"2026-06-05","author":"@skillopedia","version":"v1","category":"software-engineering","category_label":"Engineering"},"exact_dupes_collapsed_into_this":0},"version":"v1","category":"software-engineering","import_tag":"clean-skills-v1","description":"Analyze git repository changes, branch differences, and commit history. Use when analyzing branches, comparing changes, examining commit history, or preparing for PR/commit operations."}},"renderedAt":1782979339918}

Git Analysis This Skill provides comprehensive git repository analysis capabilities for understanding branch changes, commit history, and code differences. Capabilities - Analyze branch differences and merge bases - Extract structured commit history - Identify changed files and their statistics - Determine default branches and remote configuration - Support PR creation, code review, and commit operations When to Use Use this Skill when you need to: - Analyze what changed in a branch - Prepare information for PR creation - Review commit history - Compare branches - Understand code changes for…