squash-and-push
Skill0 starsChanged 4 months agoMITView on GitHub
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.
- Deletes or force-pushes
- Commits and pushes
In this repository40 other files it gives its agents.
- address-pr-feedbackSkill
- architectureSkill
- code-reviewSkill
- code-structureSkill
- competitive-briefSkill
- contract-guardSkill
- debugSkill
- deep-workSkill
- dependency-upgradeSkill
- deploy-checklistSkill
- diagnoseSkill
- documentationSkill
- explain-pr-step-by-stepSkill
- feedback-checkpointSkill
- grill-meSkill
- grill-with-docsSkill
- handoffSkill
- improve-codebase-architectureSkill
- incident-responseSkill
- memory-managementSkill
- observabilitySkill
- plan-criticSkill
- plan-from-rfcSkill
- pr-babysitterSkill
- prototypeSkill
- queue-checkSkill
- rebase-onto-mainSkill
- releaseSkill
- security-reviewSkill
- setup-engineering-skillsSkill
- synthesize-researchSkill
- system-designSkill
- tddSkill
- tech-debtSkill
- testing-strategySkill
- to-issuesSkill
- to-prdSkill
- triageSkill
- verification-before-completionSkill
- zoom-outSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. About 0 are common, 8 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 12
Run git branch --show-current.
- Very specific: line 13
Run git status --short and git rev-parse --abbrev-ref --symbolic-full-name @{u}.
- Distinctive: line 14
If upstream is missing, stop and ask which base/upstream to use.
- Distinctive: line 15
Run git fetch origin main (substitute the repo's actual default branch throughout).
- Distinctive: line 18
If git status --short is not empty, stage with git add -A and commit using the repo's commit-message convention.
- Distinctive: line 19
Always pass the commit message via HEREDOC.
- Distinctive: line 22
Use the base branch as the root reference:
- Very specific: line 27
If BRANCH_COMMITS and MAIN_DELTA differ, stop and report the blocker before squashing.
- Very specific: line 29
If BRANCH_COMMITS is 0, report the blocker (nothing to squash) and stop.
- Very specific: line 33
If BRANCH_COMMITS > 1, run git reset --soft HEAD~$BRANCH_COMMITS.
- Distinctive: line 34
Create one final commit in the repo's message convention, via HEREDOC.
- Very specific: line 46
Never calculate the squash span from @{u}..HEAD.
- Very specific: line 47
Never run git reset --soft origin/main or any non-HEAD~N reset target for the squash.
- Very specific: line 48
Never use plain --force; always --force-with-lease.
- Distinctive: line 49
If conflicts or errors occur, stop and report the exact blocker before retrying.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

