squash-branch
Review commits in a branch, date range, or recent history; group related work into a clean linear history; and verify that the final tree is unchanged.
Skill by jcottam
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/jcottam-squash-branch
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/squash-branch
What's inside
- Skill name
squash-branch- Description
- Review commits in a branch, date range, or recent history; group related work into a clean linear history; and verify that the final tree is unchanged. Use when the user asks to squash commits, clean Git history, combine WIP commits, organize today's commits, or prepare a readable commit stack.
- License
- MIT
- Metadata
- author: jcottam · version: 1.0.0
- Instructions
- 131 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Squash Branch Turn noisy Git history into a small, reviewable commit stack without changing the final code. ## Workflow 1. Define the commit range. 2. Review each commit's purpose and files. 3. Group related commits. 4. Create a backup branch. 5. Rebuild the commits. 6. Compare the rebuilt tree with the backup. 7. Run the project's tests and build. 8. Push with `--force-with-lease`. ## 1. Define the range Use the range named by the user: - Feature branch: `<base>..HEAD` - Since a commit or tag: `<ref>..HEAD` - Today's work: commits since local midnight - Recent work: the requested number of commits Confirm the current branch, working tree, remote, and selected base before changing history. If there are uncommitted changes, commit them only when the user asks. Otherwise, ask whether to commit or stash them. ## 2. Review the commits Read the log, messages, and file statistics: ```bash git log <range> --reverse --format="%H %s%n%b---" git diff <base>...HEAD --stat git show --stat <sha> ``` Group commits by purpose. Combine fixups, tests, documentation, and polish with the change they support. Keep unrelated features, infrastructure changes, and reverts separate. Prefer a few clear commits, but do not force unrelated work into an arbitrary commit count. ## 3. Create a backup ```bash git branch backup/<branch>-<date> HEAD ``` Record the original tip and base commit. The backup protects the exact tree while history is rebuilt. ## 4. Rebuild the history Reset to the base only after the backup exists: ```bash git reset --hard <base> ``` For contiguous groups, restore the tree at each group's tip: ```bash git read-tree -u --reset <group-tip> git commit -m "<clear subject>" -m "<why this group exists>" ``` For non-contiguous groups, apply the selected commits without committing, then create one new commit: ```bash git cherry-pick -n <sha-1> <sha-2> <sha-3> git commit -m "<clear subject>" -m "<why this group exists>" ``` Keep commits in their original order unless reordering is required to form a logical group. Stop and report conflicts rather than guessing how to resolve them. Do not use `git checkout <sha> -- .` to restore a full tree. It can leave files that later commits deleted. ## 5. Verify The rebuilt tree must exactly match the backup: ```bash git diff --exit-code backup/<branch>-<date> HEAD git log <base>..HEAD --oneline git status --short ``` Run the repository's normal quality gates. Include tests and a production build when available. If the tree differs or a quality gate fails, do not push. ## 6. Push safely Rewriting `main` or `master` requires clear user approval. Warn that other checkouts may need to reset after the push. ```bash git push --force-with-lease origin <branch> ``` Never use a plain `--force` push. Delete the backup only after verification and the push both succeed. ## Commit messages - Use an imperative subject of 72 characters or fewer. - Explain why the group exists in one or two body sentences. - Do not list every changed file.
From jcottam/agent-resources, MIT.
More from jcottam/agent-resources
- 0.652score
ship
jcottam
Validate a branch, run quality gates, update documentation and changelog, and open a pull request.
SkillAFreshness: A★ 25Claude Code +9 - 0.647score
new-project
jcottam
Kickstart a new project by interviewing for context, choosing Astro or Next.js and extras, then scaffolding a barebones app on Vercel with Tailwind, base…
SkillAFreshness: A★ 25Claude Code +9 - 0.647score
writing-tickets
jcottam
Write or rewrite an issue tracker ticket (Linear, GitHub Issues, Jira, or similar) that a person or coding agent will pick up.
SkillAFreshness: A★ 25Claude Code +9 - 0.608score
release-notes
jcottam
Summarize a logical grouping of git commits into plain-language release notes for non-technical readers.
SkillBFreshness: B★ 25Claude Code +9 - 0.608score
promote-skill
jcottam
Move a tested personal agent skill into a shared skills repository, check for overlap, normalize metadata, update the catalog and release files, validate the…
SkillBFreshness: B★ 25Claude Code +9 - 0.603score
sounding-board
jcottam
Restate my idea in your own words so I can hear it fresh, then flag anything that sounds fuzzy, contradictory, or underspecified.
SkillBFreshness: B★ 25Claude Code +9 - 0.563score
host
jcottam
Upload files to Cloudflare R2 and return a shareable public URL.
SkillCFreshness: C★ 25Claude Code +9 - 0.557score
orient
jcottam
Orient a developer to an unfamiliar codebase by systematically exploring its structure, purpose, features, conventions, and workflows.
SkillCFreshness: C★ 25Claude Code +9 - 0.557score
content-wireframe
jcottam
Draft a content wireframe for a website or page before any design or code.
SkillCFreshness: C★ 25Claude Code +9 - 0.557score
review-pr
jcottam
Forensic, stage-aware pull request review.
SkillCFreshness: C★ 25Claude Code +9 - 0.557score
advisor
jcottam
Activate rigorous, no-nonsense advisory mode for deep analysis, research, critical review, or honest assessment.
SkillCFreshness: C★ 25Claude Code +9
Signals
- Stars
- 25
- Forks
- 1
- Open issues
- 0
- Last commit (this folder)
- Sep 20, 2026 (1 month ago)
From GitHub (fetched Oct 24, 2026).
Details
- Version
- 1.0.0
- License
- MIT
- Repository
- github.com/jcottam/agent-resources
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from jcottam
- 0.652score
ship
jcottam
Validate a branch, run quality gates, update documentation and changelog, and open a pull request.
SkillAFreshness: A★ 25Claude Code +9 - 0.647score
new-project
jcottam
Kickstart a new project by interviewing for context, choosing Astro or Next.js and extras, then scaffolding a barebones app on Vercel with Tailwind, base…
SkillAFreshness: A★ 25Claude Code +9 - 0.647score
writing-tickets
jcottam
Write or rewrite an issue tracker ticket (Linear, GitHub Issues, Jira, or similar) that a person or coding agent will pick up.
SkillAFreshness: A★ 25Claude Code +9 - 0.608score
release-notes
jcottam
Summarize a logical grouping of git commits into plain-language release notes for non-technical readers.
SkillBFreshness: B★ 25Claude Code +9 - 0.608score
promote-skill
jcottam
Move a tested personal agent skill into a shared skills repository, check for overlap, normalize metadata, update the catalog and release files, validate the…
SkillBFreshness: B★ 25Claude Code +9 - 0.603score
sounding-board
jcottam
Restate my idea in your own words so I can hear it fresh, then flag anything that sounds fuzzy, contradictory, or underspecified.
SkillBFreshness: B★ 25Claude Code +9
Cite this page
squash-branch skill. Agent Mart. https://agentmart.dev/skills/jcottam-squash-branch (last updated 2026-10-24)