원클릭으로
restructure-pr-commits
Restructure the commits on an existing PR into focused, reviewable commits
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Restructure the commits on an existing PR into focused, reviewable commits
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | restructure-pr-commits |
| description | Restructure the commits on an existing PR into focused, reviewable commits |
Restructure the commits on PR <number> into focused, reviewable commits.
Follow these steps in order exactly.
Run:
git diff upstream/main HEAD --stat
This is the authoritative list of files the PR modifies. git log is misleading
on branches kept up to date via merge: merge commits drag upstream history into the
log as if it were authored on this branch — it isn't.
Run:
git log --first-parent --no-merges upstream/main..HEAD --oneline
This shows only commits made directly on this branch.
git branch backup-pr-<number> HEAD
Do this before changing anything. Never skip this step.
Check out a fresh branch from upstream/main:
git checkout upstream/main -b restructured-pr-<number>
Then restore the changed files from the backup:
git checkout backup-pr-<number> -- <files from step 1>
Handle renames explicitly: git rm <old> then git checkout backup-pr-<number> -- <new>.
Commit in logical groups — one concern per commit. Commit message rules (from the project's AGENTS.md):
fix:, feat:, etc.)Run both and report the output:
git diff HEAD backup-pr-<number>
git diff HEAD upstream/main --stat
The first command must produce no output; if it does, stop and investigate before continuing. The second must list exactly the same files as step 1.
Show the new git log --oneline and ask the user to confirm the history looks
correct. Do not proceed until the user explicitly says yes.
git push origin HEAD:<pr-branch-name> --force-with-lease
Never use --force alone.
Rewrite the PR title and description to match the restructured commits.
Structure: Summary → one Changes section per commit → optional Combined effect.
Each Changes section maps 1-to-1 to a commit. Apply the PR-creation flow from
docs/agents/release-and-versioning.md for labels and breaking-change callouts.