是否有用于比较来自 git 存储的文件的 --staged(又名 --cached)选项?
在这里,我将最近的提交与暂存文件进行比较(我使用显式 @{} 语法,但我知道可以推断出 @{0}):
git diff stash@{0}:spec/blueprints.rb HEAD:spec/blueprints.rb
在这里我将 stash 的文件与磁盘上的文件进行比较:
git diff stash@{0}:spec/blueprints.rb spec/blueprints.rb
我如何比较当前上演的内容和 stash 的内容?这不起作用:
git diff --staged stash@{0}:spec/blueprints.rb spec/blueprints.rb
最佳答案
git diff --cached 'stash@{0}' -- spec/blueprints.rb
...可能不需要引号,但您永远不知道您的 shell 会给您带来怎样的惊喜。
关于git - 将暂存文件与 stash 文件进行比较,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10687682/