squash-commits
Skill này làm gì
Skill này sắp xếp lại các commit trên nhánh hiện tại của bạn thành một bộ commit logic nhỏ gọn. Skill dành cho lập trình viên muốn lịch sử sạch trước khi chia sẻ công việc của mình.
Khi nào nên dùng
- ✓Khi nhánh của bạn có nhiều commit nhỏ hoặc lộn xộn và bạn muốn lịch sử gọn hơn.
- ✓Khi bạn muốn gom các thay đổi liên quan thành vài commit có ý nghĩa trước khi mở pull request.
- ✓Khi bạn cần loại bỏ các merge commit từ main đã được kéo vào nhánh của bạn.
Liên kết skill
https://github.com/pipecat-ai/pipecat/blob/main/.claude/skills/squash-commits/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Bạn có thể dọn các commit trên nhánh của tôi thành vài commit rõ ràng mà không thay đổi bất kỳ mã nào không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent kiểm tra xem công việc của bạn đã được lưu chưa, tạo một bản sao lưu của nhánh, rồi reset các commit trong khi giữ lại mọi thay đổi. Sau đó nó đề xuất các nhóm và hỏi bạn xác nhận trước khi commit.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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>.
Câu hỏi thường gặp
Skill này có thay đổi mã của tôi không?
Không. Skill chỉ thay đổi cách sắp xếp các commit, không thay đổi nội dung của bất kỳ file nào.
Có cách nào hoàn tác không?
Có. Skill tạo một nhánh sao lưu trước, nên bạn có thể quay lại các commit ban đầu nếu cần.
Nó có cần tôi xác nhận cách nhóm không?
Có. Agent trình bày các nhóm commit đề xuất và xin phê duyệt của bạn trước khi commit.
Chi tiết
Mô tả gốc của tác giả
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
Độ phổ biến
- Sao GitHub
- 17k
- Vị trí xếp hạng
- #10793
- Giấy phép
- BSD-2-Clause
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
Skill tương tự
diffs
394kGiúp agent của bạn tạo một diff có thể chia sẻ về các chỉnh sửa, dưới dạng liên kết xem hoặc file ảnh, thay vì một bản tóm tắt viết tay.
coding-agent
394kGiúp agent của bạn giao một việc lập trình lớn cho Codex, Claude Code hoặc OpenCode chạy nền, rồi theo dõi tiến độ của nó.
gh-issues
394kGiúp agent của bạn tìm issue trên GitHub, chọn những issue cần xử lý và mở pull request với bản sửa, kể cả theo dõi nhận xét đánh giá.