local-link/skills/rebase-commits/SKILL.md
将零散的 commits 整合为清晰的逻辑提交,使 Git 历史更易读。 Use when: (1) 用户说 "rebase commits"、"整理提交历史"、"让历史更干净" (2) 用户想将多个相关 commits 合并为逻辑单元 (3) 完成一个功能后需要清理 commit 历史 (4) 提交历史混乱,需要重新组织
npx skillsauth add lionad-morotar/local-tools 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
分批提交 Git 变更的完整工作流。当用户说"提交这个文件"、"帮我 commit"、"分批提交"、"整理提交计划"、"staged 的文件"、"git 提交"时触发
tools
从用户给出的文档片段中,提取"进阶必知"的深层知识,当用户提到"太简单了,给我几条秘密","面试必备的那种","八股文进阶"时触发
data-ai
批量给技能目录添加 disable-model-invocation,节省 token 开销。只保留需要 LLM 生成/分析/决策的技能有模型调用能力。
tools
open understand dashboard for user