agentsclimarketplace

Squash and push

Skill IcodeNet/agent-skills/skills/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

Install
npx -y skills add IcodeNet/agent-skills --skill squash-and-push

Assembled 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.

  1. Safety + scope checks

    • Run git branch --show-current; abort if on main/master.
    • Run git status --short and git 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).
  2. Commit working changes first (required when dirty)

    • If git status --short is not empty, stage with git add -A and commit using the repo's commit-message convention.
    • Always pass the commit message via HEREDOC.
  3. 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_COMMITS and MAIN_DELTA differ, 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_COMMITS is 0, report the blocker (nothing to squash) and stop.
  4. Squash into one commit

    • git add -A.
    • If BRANCH_COMMITS > 1, run git reset --soft HEAD~$BRANCH_COMMITS.
    • Create one final commit in the repo's message convention, via HEREDOC.
  5. Push safely

    • git push --force-with-lease.
  6. Verify + report

    • git status --short (expect clean).
    • Recompute: git rev-list --count "$(git merge-base origin/main HEAD)..HEAD" (expect 1) and git rev-list --count origin/main..HEAD (expect 1).
    • 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/main or any non-HEAD~N reset 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.

Keep looking

Skills are one crate of 327,132. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.