我目前正在尝试在一个存储库中查找一些更改,我知道它是stash@{1}。为此,我使用git grep
git grep somePattern stash@{1}这将返回我正在搜索的内容。
但是,当运行git stash show时,这些更改不在这里,我得到一个不同的差异,不包含我的更改。
git stash show stash@{1}同样的事情,如果我尝试git stash apply所说的改变。
在显示/应用存储时,git stash是否有任何行为阻止更改成为该存储的一部分?
发布于 2021-01-21 19:07:15
git grep在提交的完整内容中搜索模式(不仅仅是它引入的更改)。
如果somePattern出现在任何其他文件中(包括未在存储中更改的文件),您将看到一个输出。
如果要找出其中的更改包含模式的文件,而不是git grep,请尝试以下操作之一:
git show -S somePattern stash@{1}
# or :
git show -G somePattern stash@{1}在您的例子中:看起来您正在寻找的模式不是stash@{1}更改的一部分。
如果您想检查所有stash条目的内容,请在git reflog stash上使用-S或-G选项之一:
# * you also need the '-m' option when inspecting the stash, because all
# stash entries are actually merge commits
# * '-p' will print the patch of files matching the pattern, and will
# allow you to see if those are the changes you are looking for
git reflog --oneline -m -S somePattern -p stashhttps://stackoverflow.com/questions/65825775
复制相似问题