Git:暂存补丁的能力

发布于 2024-12-22 10:03:37 字数 252 浏览 3 评论 0原文

Git 的后续内容:能够在不接触工作树的情况下暂存特定文件内容

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

Follow-up from Git: ability to stage a certain file content without touching the working tree:

I want to modify the index of one (text) file by staging a patch (against HEAD) without having to change the working tree file state. Is this possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

静赏你的温柔 2024-12-29 10:03:37

您需要 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.

You want git apply --cached

From the man page:

   --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.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文