推荐使用 git add -p 来精确选择行,这样既方便又不会破坏代码结构 git add -p 按块(hunk)交互选择代码进行暂存。常用的选项包括: y:暂存此块。 n:跳过此块。 s:拆分块。 e:编辑块。 q:退出。