是否可以从 git stash 中删除单个文件?
是否可以不弹出整个存储并保存另一个没有此特定文件的存储?
Is it possible, without pop whole stash and save another without this particular file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
简短的回答:不,这不是堆栈的工作原理。您可以执行以下操作来获得您想要的结果。
假设您存储了一些其他更改,然后对索引进行了一些修改(原始更改),并且您决定在修改存储时保留这些更改:
我建议使用此工作流程,而不是尝试直接修改存储。如果您迷失在存储数字中,您还可以使用
git stash save '一些其他更改'
在某个时刻(可能比您想象的更近)更容易跟踪真实的分支。
Short answer: no, that's not how the stack works. You can do the following though to get the result you're looking for.
Assuming that you have stashed some other changes, then made some more modifications to your index (original changes) and you decide that you want to keep these changes while modifying the stash:
I'd recommend this workflow over trying to modify the stash directly. If you get lost in stash numbers you can also use
git stash save 'some other changes'
At some point (probably nearer than you think) it's easier to keep track of real branches.
您可以尝试在弹出堆栈后将您不想存储的文件标记为“unchanged”:,
然后尝试存储,检查是否包含该文件。
git update-index
手册页:You could try, after popping your stack, to mark the file you don't want to stash as "unchanged":
, and then try to stash, checking if said file is included or not.
git update-index
man page: