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
理解用户意图;listen 模式通过 grill-me 深挖任务并归档经验
development
给 VSCode(Insiders/Stable) 内置 ripgrep 加 5s 超时包装,防止搜索卡死吃满 CPU。--on 包装(幂等) / --off 还原 / 不带参数查状态。Use when VSCode 搜索卡死、rg 进程占满 CPU,或 VSCode 更新后超时保护失效需要重包。
development
为指定项目创建完全隔离的 hapi(Claude Code On the Go)实例,包括独立数据目录、LaunchAgent 持久化、zsh wrapper 和 app.hapi.run 直连 URL。与全局 ~/.hapi 互不干扰。
development
关闭承载当前 Claude Code 会话的宿主(VSCode 窗口或其终端面板),连同 claude 一起退出。通过 close-host-window 扩展触发:先 SIGTERM claude(走完 SessionEnd hooks)再关 host,不抢焦点、不丢 hooks。--host vscode 关窗口、--host terminal(默认)只关终端面板。Use when 任务结束要随宿主退出,或需精确关闭某 claude 终端所在窗口/面板。