Squash and push
40 portable full-SDLC agent skills for Claude Code, Cursor, Codex, and GitHub Copilot — deep-work autonomy, contract-guard for external interfaces, TDD, code review, PR babysitting. Install: npx github:IcodeNet/agent-skills
npx -y skills add IcodeNet/agent-skills --skill squash-and-pushAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- 28 days oldThe repository was created 28 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Squash the current branch's full history since its base into one commit and force-push with lease. Manual command — run with /squash-and-push when the user asks to squash and push the current branch as a single commit.
SKILL.md
2.5 KB, 581 tokens by cl100k_base, as published. Nobody here has run it
Squash and Push
Squash all commits on the current branch (since it diverged from the base branch) into one commit, then push with --force-with-lease.
-
Safety + scope checks
- Run
git branch --show-current; abort if onmain/master. - Run
git status --shortandgit rev-parse --abbrev-ref --symbolic-full-name @{u}. - If upstream is missing, stop and ask which base/upstream to use.
- Run
git fetch origin main(substitute the repo's actual default branch throughout).
- Run
-
Commit working changes first (required when dirty)
- If
git status --shortis not empty, stage withgit add -Aand commit using the repo's commit-message convention. - Always pass the commit message via HEREDOC.
- If
-
Determine the full squash span
- Use the base branch as the root reference:
BASE=$(git merge-base origin/main HEAD)BRANCH_COMMITS=$(git rev-list --count "$BASE..HEAD")
- Sanity check to avoid misparsed ranges:
MAIN_DELTA=$(git rev-list --count origin/main..HEAD)- If
BRANCH_COMMITSandMAIN_DELTAdiffer, stop and report the blocker before squashing.
- The span is always the full branch history since base — including commits already pushed — never just
@{u}..HEAD. - If
BRANCH_COMMITSis0, report the blocker (nothing to squash) and stop.
- Use the base branch as the root reference:
-
Squash into one commit
git add -A.- If
BRANCH_COMMITS > 1, rungit reset --soft HEAD~$BRANCH_COMMITS. - Create one final commit in the repo's message convention, via HEREDOC.
-
Push safely
git push --force-with-lease.
-
Verify + report
git status --short(expect clean).- Recompute:
git rev-list --count "$(git merge-base origin/main HEAD)..HEAD"(expect1) andgit rev-list --count origin/main..HEAD(expect1). - Report branch name, new commit SHA, and confirmation of a single-commit branch.
Hard constraints
- Never calculate the squash span from
@{u}..HEAD. - Never run
git reset --soft origin/mainor any non-HEAD~Nreset target for the squash. - Never use plain
--force; always--force-with-lease. - If conflicts or errors occur, stop and report the exact blocker before retrying.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.