local-link/skills/rebase-commits/SKILL.md
将零散的 commits 整合为清晰的逻辑提交,使 Git 历史更易读。 Use when: (1) 用户说 "rebase commits"、"整理提交历史"、"让历史更干净" (2) 用户想将多个相关 commits 合并为逻辑单元 (3) 完成一个功能后需要清理 commit 历史 (4) 提交历史混乱,需要重新组织
npx skillsauth add lionad-morotar/simple-local-llm-server rebase-commitsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
将零散的 commits 整合为清晰的逻辑提交。自动识别 commit 分组模式,生成 rebase 脚本,批量修改 commit message。
获取需要 rebase 的 commit 范围:
# 查看 commit 历史
git log --oneline <start-commit>..HEAD
# 统计数量
git rev-list --count <start-commit>..HEAD
根据 commit message 和文件变更识别分组策略:
| 模式 | 识别特征 | 分组策略 |
|------|----------|----------|
| 功能分组 | 相同功能/模块的变更 | 每个功能合并为 1 个 commit |
| 类型分组 | docs:、feat:、fix:、chore: | 按类型和逻辑合并 |
| 目录分组 | 相同目录的文件变更 | 按模块合并 |
| 工作流分组 | docs(phase-01)、feat(plan-01) | 按阶段/计划合并 |
向用户展示建议的分组方案:
建议将 N 个 commits 合并为 M 个逻辑提交:
1. init: 项目初始化与基础配置
- 包含: chore: add config, docs: readme...
2. feat: 实现核心功能 A
- 包含: feat: add component, fix: bug fix...
3. feat: 实现核心功能 B
- 包含: feat: add service, test: add tests...
确认此方案?或需要调整?
在执行 rebase 前创建备份:
git branch backup/<branch-name>-pre-rebase
使用交互式 rebase:
# 启动交互式 rebase
git rebase -i <base-commit>^
# 在编辑器中调整:
# - pick: 保留 commit
# - squash/s: 合并到前一个 commit
# - fixup/f: 合并并丢弃 message
# - reword/r: 修改 message
确保 message 清晰描述变更:
<type>(<scope>): <subject>
<body>
# 查看新的 commit 历史
git log --oneline <base-commit>..HEAD
# 确认文件状态
git status
优化后的 message 应遵循:
<type>(<scope>): <subject>
类型说明:
- feat: 新功能实现
- fix: 修复问题
- docs: 文档更新
- chore: 杂项(构建、工具等)
- refactor: 重构(无功能变化)
- test: 测试相关
- style: 代码格式(不影响功能)
b2799237 docs: add readme
ed56958e fix: typo
2aa4a3e1 feat: add login page
a0fd7b27 feat: add login api
e15b958e fix: login bug
...
ca1036c7 docs: 添加项目文档
8f336f51 feat: 实现用户登录功能
9632bb66 feat: 实现用户注册功能
如果 rebase 后需要恢复:
git reset --hard backup/<branch-name>-pre-rebase
git rebase --continuetools
open understand dashboard for user
tools
这是一个技能文件的模板,展示了技能的基本结构和内容组织方式。
development
Be direct and informative. No filler, no fluff, but give enough to be useful.
development
使用 Evaluator-optimizer 模式进行系统性多轮网络搜索,采用结构化 Ask 流程在搜索前澄清研究目标。基于 YC Office Hours 的提问方法论,确保搜索方向清晰、结果可验证。当用户需要深入调查复杂主题、验证假设或全面收集信息时使用。