| 用途 | 把粗粒度提交拆细 |
|---|---|
| 步骤 | rebase -i 标记 edit → reset HEAD^ → git add -p → 多次 commit → --continue |
| 配套 | git add -p 交互式暂存 |
操作步骤
操作步骤
git rebase -i HEAD~3 # 目标行改为 edit
git reset HEAD^
git add -p
git commit -m 'feat: 拆出参数校验'
git add src/other.js
git commit -m 'feat: 拆出错误处理'
git rebase --continue拆分后每个提交都应能独立通过构建与测试,做不到时就保持为单个提交。