Squash

From drn/dots · View interactive version

Squash is an AI agent skill from the GitHub repository drn/dots. Squash all branch commits into one and update open PRs. Use when squashing commits, cleaning up history, or condensing branch commits before merge.

How to use this skill

Skill file

Context

Your task

Squash all commits on the current branch (since it diverged from the default branch) into a single commit, then force-push to update any open PR.

In all steps below, substitute <remote> and <default-branch> with the values determined in Step 1.

Step 0: Validate state

Step 1: Determine the base branch and fetch

Step 2: Count commits

Step 3: Draft the squash commit message

Read the full diffs and all individual commit messages:

git log <merge-base-SHA>..HEAD --format="%s%n%n%b"
git diff <merge-base-SHA>..HEAD --stat

Write a single commit message that:

Step 4: Squash

git commit -m "$(cat <<'EOF'
Subject line here

Body here.

Co-Authored-By: ...
EOF
)"

Step 5: Force push (conditional)

Step 6: Report summary

Print a concise summary:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.