Git:修补补丁的能力

时间:2011-12-21 10:15:47

标签: git stage

来自Git: ability to stage a certain file content without touching the working tree的跟进:

我想通过暂存补丁(针对HEAD)来修改一个(文本)文件的索引,而不必更改工作树文件状态。这可能吗?

1 个答案:

答案 0 :(得分:4)

您想要git apply --cached

从手册页:

   --cached
       Apply a patch without touching the working tree. Instead take the cached data, apply the patch, and store
       the result in the index without using the working tree. This implies --index.