How do I generate a PR summary?

Table of Contents

For the surrounding lifecycle — create, monitor, merge — see PR Manager.

Question

I have local commits on a feature branch. How do I derive the PR title and the structured body from them?

Answer

  1. Find the branch point against main:

    merge_base=$(git merge-base HEAD main)
    echo "branch point: ${merge_base}"
    
  2. Collect commit messages since the branch point:

    git log --pretty=format:"%s" $(git merge-base HEAD main)..HEAD
    
  3. Derive the title. Use the format [COMPONENT] Description. Pick the most representative commit, or combine if the PR spans multiple components (e.g. [trading,sql]).
  4. Assemble the body. Use this skeleton:

    ## Summary
    
    One-paragraph summary: what changes, why.
    
    ## Changes
    
    - Bullet per material change, grouped if the PR spans components.
    
    ## Notes / Decisions
    
    - Anything non-obvious about the implementation.
    
    ## Captures
    
    - Captures filed while doing this work — bugs, limitations, or ideas
      noticed in passing and recorded with `compass capture` (they land in
      the product-backlog inbox). One Markdown link per line. Omit the
      section if there were none.
    

    Do not add a "Test plan" section — convention in this repo per CLAUDE.md.

Script

No wrapper — the operations are bare git invocations.

Tested by

Manual. Reviewers catch any divergence between commit set and PR summary.

See also

  • How do I create a PR? — the next step in the lifecycle.
  • PR Manager — the skill that indexes the full PR lifecycle.

Emacs 29.1 (Org mode 9.6.6)