流程可能在未单独确认的情况下创建分支和多次 Git 提交
原文依据:5 处指导把“提交当前状态”“创建功能分支”“测试通过就提交”和“最终提交”列为默认重构步骤,而不是需用户明确同意的可选动作。
当用户只要求查看、建议或工作区修改时,代理仍可能改变当前分支状态并写入多条持久提交;自动编写缺失测试和删除被判定为死代码也会扩大文件改动范围。
该流程把创建功能分支和多次 Git 提交列为常规步骤,没有说明须先获得用户同意。若代理照此执行,会改动仓库历史和分支状态,可能干扰用户现有工作流或生成不需要的提交。用户可要求作者将这些操作改为仅在明确授权后执行,或限制技能不得创建分支和提交。
```1. PREPARE - Ensure tests exist (write them if missing) - Commit current state - Create feature branch2. IDENTIFY - Find the code smell to address - Understand what the code does - Plan the refactoring3. REFACTOR (small steps) - Make one small change - Run tests - Commit if tests pass - Repeat查看另外 4 个位置
5. CLEAN UP - Update comments - Update documentation - Final commit```### 9. Dead Code```diff# BAD: Unused code lingers- function oldImplementation() { /* ... */ }- const DEPRECATED_VALUE = 5;- import { unusedThing } from './somewhere';- // Commented out code- // function oldCode() { /* ... */ }# GOOD: Remove it+ // Delete unused functions, imports, and commented code+ // If you need it again, git history has it``````1. PREPARE - Ensure tests exist (write them if missing) - Commit current state - Create feature branch3. REFACTOR (small steps) - Make one small change - Run tests - Commit if tests pass - Repeat