gpt4 book ai didi

git - 是否可以从 git stash 中删除单个文件?

转载 作者:太空狗 更新时间:2023-10-29 13:24:58 28 4
gpt4 key购买 nike

有没有可能不 pop 整个存储并在没有这个特定文件的情况下保存另一个存储?

最佳答案

简短回答:不,堆栈不是这样工作的。不过,您可以执行以下操作以获得所需的结果。

假设您已经 stash 了一些其他更改,然后对您的索引进行了更多修改(原始更改)并且您决定在修改时保留这些更改 stash :

#verify the state you are in
git stash list
git status

git stash #push work in progress on the stash
git stash list #check which stash you need
git stash show stash@{1} #check the changes in the stash

git stash pop stash@{1} #you're now ready to change your 'other' changeset
# hack hack
git stash #modified 'other' change set pushed on the stash
git stash pop stash@{1} #your 'original changes'

我建议使用此工作流程而不是尝试直接修改存储。如果您迷失在存储编号中,您还可以使用 git stash save 'some other changes'

在某个时间点(可能比您想象的更近)更容易跟踪真实的分支。

关于git - 是否可以从 git stash 中删除单个文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3124185/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com