Git Summarize Changes

Summarize current-branch changes vs an auto-discovered base branch for MR-style output. Use when the user asks to summarize git changes, draft an MR description, or compare against main/release.

evindunn 00249c1 3 files · 1.6 KB Updated

File contents

Git Summarize Changes

Produce a concise summary from <base_branch>..HEAD as the source of truth.

Base branch

  1. User-specified base branch, if given.
  2. Else default remote branch:
BASE_BRANCH="$(git symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null | sed 's|^origin/||')"
  1. If empty, ask the user for a base branch.

Workflow

  1. Run from repo root; validate branch and range from git (do not trust stale chat).
  2. Reuse chat context only if it matches current <base_branch>..HEAD.
  3. Draft markdown; copy to clipboard when possible; paste the same in chat.

Validate

git rev-parse --verify "$BASE_BRANCH" >/dev/null
git rev-parse --abbrev-ref HEAD
git log --oneline "$BASE_BRANCH"..HEAD
git diff --stat "$BASE_BRANCH"...HEAD

Empty range: say so; do not invent a summary.

Output template

## Summary
- <2-5 bullets on intent and impact>

Clipboard (macOS)

cat <<'EOF' | pbcopy
## Summary
- <final bullets>
EOF

If pbcopy fails, retry with needed permissions and still paste the markdown in chat.

evindunn/ai-skills/tree/main/git-summarize-changes commit 00249c10d9

Frequently asked questions

npx skillmds@latest add evindunn/git-summarize-changes