# 1. 回退到移动文件的前一个提交(保留修改内容,回到未提交状态)# 把 <commit-id> 换成移动文件那次提交的上一个ID
git reset --soft <commit-id>
# 2. 先删除暂存区的错误变更
git reset HEAD 旧路径/test_isz_scene_detect.cc
git reset HEAD 新路径/test_isz_scene_detect.cc
(# 1. 恢复被标记为删除的源文件(关键:把D状态的文件恢复为正常状态)
git restore test/unit_testing/control_logic/test_isz_scene_detect.cc
# 2. 确认文件已恢复(此时应该看不到D状态了)
git status --porcelain
# 3. 确保目标路径的无效文件(如果有)被清理(避免冲突)
rm -f test/src/dt/sanity_testing/test_isz_scene_detect.cc
# 4. 现在执行 git mv 就会成功了
git mv test/unit_testing/control_logic/test_isz_scene_detect.cc test/src/dt/sanity_testing/test_isz_scene_detect.cc
# 5. 查看状态(此时应该显示 renamed: 旧路径 -> 新路径)
git status
)