本文へスキップ
Skillpedia
一般的なプログラミング17k · #10793

squash-commits

できること

このスキルは、現在のブランチのコミットを、少数の論理的なコミットに整理します。共有する前に、きれいな履歴を用意したい開発者向けです。

使う場面

  • ✓ブランチに小さく雑多なコミットが多く、履歴を整理したいとき。
  • ✓プルリクエストを開く前に、関連する変更を数個のまとまったコミットにしたいとき。
  • ✓ブランチにmainからマージしたマージコミットがあり、それを取り除く必要があるとき。

スキルのリンク

https://github.com/pipecat-ai/pipecat/blob/main/.claude/skills/squash-commits/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/pipecat-ai/pipecat/blob/main/.claude/skills/squash-commits/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“コードは変えずに、私のブランチのコミットを数個のわかりやすいコミットにまとめてください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

エージェントは、作業が保存されているか確認し、ブランチのバックアップを作り、すべての変更を残したままコミットをリセットします。その後、まとめ方の案を示し、コミットする前にあなたの確認を求めます。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)を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 main is 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>.
よくある質問

このスキルはコードを変えますか?

いいえ。コミットの並べ方だけを変えることを目的としており、どのファイルの内容も変えないよう設計されています。

取り消す方法はありますか?

はい。このスキルは最初にバックアップブランチを作るので、必要なら元のコミットに戻せます。

まとめ方を確認する必要がありますか?

はい。エージェントはコミットのまとめ方の案を示し、コミットする前にあなたの承認を求めます。

詳細

作者による元の説明

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

人気

GitHubのスター
17k
ランキング
#10793
ライセンス
BSD-2-Clause
更新日
2026/11/2

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル