squash-commits
What it does
This skill reorganizes the commits on your current branch into a small set of logical commits. It is for developers who want a clean history before sharing their work.
When to use it
- ✓When your branch has many small or messy commits and you want a cleaner history.
- ✓When you want to group related changes into a few meaningful commits before opening a pull request.
- ✓When you need to remove merge commits from main that were pulled into your branch.
Skill link
https://github.com/pipecat-ai/pipecat/blob/main/.claude/skills/squash-commits/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Can you tidy up the commits on my branch into a few clear ones without changing any code?”
5 new skills a week. 1 minute to read.
How it works
The agent checks that your work is saved, makes a backup copy of the branch, and resets the commits while keeping every change. It then proposes groups and asks you to confirm before committing.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Reorganize the commits on the current branch into a small number of logical commits. Do NOT change any file content — only the commit structure changes.
Instructions
1. Safety check
git status --short
If there are uncommitted changes, stop and tell the user to commit or stash them first.
2. Inspect the branch
git log main..HEAD --oneline
git diff main..HEAD --name-only
List every file changed vs main and every commit on the branch (excluding merge commits from main).
3. Create a backup branch
git branch backup/<current-branch-name>
Tell the user the backup exists so they can recover if needed.
4. Soft-reset to main and unstage everything
git reset --soft main
git restore --staged .
All branch changes are now in the working tree, unstaged. No content has changed.
5. Plan the logical groups
Read the changed files and the original commit messages to understand what the work covers. Group related files into logical commits. Typical groups:
- Core feature or fix (new source files + modified core files)
- Secondary features or fixes (each as its own commit if distinct)
- Refactoring or renames
- Tests
- Changelogs / docs
Use the changelog files (if any) as a strong hint — each changelog entry often maps to one commit.
Present the proposed grouping to the user and ask for confirmation before committing.
6. Commit in logical groups
For each group, stage only the relevant files and commit with a clear message following the project's conventions:
git add <file1> <file2> ...
git commit -m "..."
Use conventional commit prefixes if the project uses them (feat:, fix:, refactor:, test:, chore:).
7. Verify
git log main..HEAD --oneline
git diff main..HEAD --name-only
git status --short
Confirm:
- Commit count is small and each message is meaningful
- The set of changed files vs
mainis identical to before - Working tree is clean
8. Remind about force-push
The branch history has been rewritten. Tell the user they will need to git push --force-with-lease when they are ready to update the remote. Do NOT push automatically.
Rules
- Never change file contents. If you find yourself editing a file, stop.
- Never skip the backup branch step.
- Never force-push without explicit user instruction.
- If any step fails or the result looks wrong, tell the user and suggest restoring from the backup:
git reset --hard backup/<branch-name>.
FAQ
Will this change any of my code?
No. The skill is meant to change only how the commits are arranged, not the content of any file.
Is there a way to undo it?
Yes. The skill creates a backup branch first, so you can go back to the original commits if needed.
Does it need me to confirm the grouping?
Yes. The agent shows the proposed commit groups and asks for your approval before making any commits.
Details
Original description by the author
Reorganize messy branch commits into a small set of logical, meaningful commits without changing any content. Drops merge-from-main commits. Safe: creates a backup branch first.
repo: pipecat-ai/pipecat
Popularity
- GitHub stars
- 17k
- Ranking position
- #10793
- License
- BSD-2-Clause
- Updated
- 11/2/2026
Comments
- …
More skills from this repository
Similar skills
diffs
394kLets your agent produce a real, shareable diff of edits as a viewer link or image file, instead of a hand-written summary.
coding-agent
394kHelps your agent hand a larger coding job to Codex, Claude Code, or OpenCode as a background worker, then check on its progress.
gh-issues
394kHelps your agent find GitHub issues, pick the ones to work on, and open pull requests with fixes, including follow-up on review comments.