squash
Git Squash
Pre-flight Checks
Before merging, validate the environment:
- Determine source branch — use the argument if provided (
/squash feature/my-branch), otherwise use the current branch. - Verify not on main — abort if source branch is
main. - Check for uncommitted changes —
git status --porcelain. If dirty, abort and suggest committing or stashing. - Verify branch exists —
git rev-parse --verify <branch>. - Verify divergence —
git log main..<branch> --oneline. If empty, abort — nothing to merge.
Switch to Main
git checkout main
If remote origin exists, pull latest with git pull --ff-only. If ff-only fails, abort — main has diverged and needs manual resolution.
Squash Merge
git merge --squash <branch>
On conflicts: git merge --abort, switch back to source branch, suggest git rebase main, stop.
Delegate to commit
Invoke /commit to handle the commit. Do not write commit messages directly.
Post-merge Verification
git log --oneline -5
git status
git diff
Confirm: clean working tree, squash commit at HEAD, no leftover staged changes.
Cleanup
Try safe delete first:
git branch -d <branch>
If -d fails (expected — squash merges don't preserve ancestry), verify zero diff with git diff main <branch>. If empty, force-delete with git branch -D <branch>. If there IS a diff, stop — something was lost.
If a remote tracking branch exists (git ls-remote --heads origin <branch>):
git push origin --delete <branch>
Rules
- Proceed without confirmation — pre-flight checks are the safety gate.
- Only merge into
main. - Always use
--squash— never fast-forward or regular merge. - Always delegate the commit to
/commit. - Abort on merge conflicts — never auto-resolve.
- Never force-push.
- Prefer
git branch -d— use-Donly after verifying zero diff. - If any step fails, stop and report the error.
Quick Reference
Pre-flight → checkout main → git merge --squash → /commit → verify → cleanup (-d, fall back to -D after zero diff check, delete remote if exists).
More from ralphcrisostomo/nuxt-development-skills
ralph
Convert PRDs to prd.json format for the Ralph autonomous agent system. Use when you have an existing PRD and need to convert it to Ralph's JSON format. Triggers on: convert this prd, turn this into ralph format, create prd.json from this, ralph json.
52prd
Generate a Product Requirements Document (PRD) for a new feature. Use when planning a feature, starting a new project, or when asked to create a PRD. Triggers on: create a prd, write prd for, plan this feature, requirements for, spec out.
39optimise-claude
Use when auditing, trimming, or restructuring AI instruction files (CLAUDE.md, SKILL.md, AGENTS.md) to reduce context-window consumption. Trigger whenever CLAUDE.md is bloated or Claude ignores instructions, a SKILL.md exceeds 120 lines, skills share duplicated content, AGENTS.md has large inline blocks, or the user asks to optimize, slim down, or reduce token usage.
37nuxt-init
Use when scaffolding a new Nuxt 4 project with standard config files (prettier, eslint, gitignore, husky, vitest, tsconfig, sops) and bun scripts.
33nuxt-terraform
Scaffold Nuxt + AWS Terraform infrastructure. Use when adding GraphQL resolvers, Lambda functions, initializing a new project with AppSync, DynamoDB, Cognito, writing Terraform tests, or generating/reviewing Terraform code style. Triggers on: add graphql resolver, create lambda, scaffold terraform, init terraform, add appsync resolver, add mutation, add query, add terraform test, write tftest, terraform style.
32todo
Use when scanning a codebase for incomplete work and maintaining a living TODO.md grouped by feature. Triggers on: scan for todos, find incomplete work, update todo, what needs doing, create todo list.
30