git-squash
Installation
SKILL.md
Git Squash
Pre-flight Checks
Before merging, validate the environment:
- Determine source branch — use the argument if provided (
/git-squash feature/my-branch), otherwise use the current branch. - Verify not on main — if the source branch is
main, abort with an error. - Check for uncommitted changes — run
git status --porcelain. If there are uncommitted changes, abort and suggest committing or stashing first. - Verify branch exists — confirm the source branch exists locally (
git rev-parse --verify <branch>). - Verify divergence from main — run
git log main..<branch> --oneline. If empty, abort — nothing to merge.
Switch to Main
git checkout main
If a remote origin exists, pull latest: