企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持知识库和私有化部署方案 广告
## 7.2 交互式暂存 运行`git add`时使用`-i`或者`--interactive`选项,Git 将会进入一个交互式终端模式。 **暂存与取消暂存文件** 暂存和取消暂存操作分别对应 `update` 和 `revert` 选项,在进入交互式暂存模式后,先选择要执行的操作,然后选择要操作的文件。 **暂存补丁** Git 也可以暂存文件的特定部分。从交互式提示符中输入 `5` 或者 `p`,Git 会询问想要暂存哪些文件;然后,对已选择文件的每一个部分,它都会一个个地显示文件区别并询问你是否想要暂存它们,这时有很多选项。 输入`?`显示所有可以使用的命令列表: ``` Stage this hunk [y,n,a,d,/,j,J,g,e,?]? ? y - stage this hunk n - do not stage this hunk a - stage this and all the remaining hunks in the file d - do not stage this hunk nor any of the remaining hunks in the file g - select a hunk to go to / - search for a hunk matching the given regex j - leave this hunk undecided, see next undecided hunk J - leave this hunk undecided, see next hunk k - leave this hunk undecided, see previous undecided hunk K - leave this hunk undecided, see previous hunk s - split the current hunk into smaller hunks e - manually edit the current hunk ? - print help ```