git stash

终端 powershell
PS E:\uniapp_mall> git stash list
stash@{0}: On v1.4.0: 支付功能
stash@{1}: WIP on dev: 9a787b8 add: IOS打包通用链接配置
stash@{2}: On dev: 储藏2
stash@{3}: On pay: 储藏3
stash@{4}: WIP on dev: d174eec add: 储藏4

PS E:\uniapp_mall> git stash apply stash@{1}
fatal: ambiguous argument 'stash@': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

https://stackoverflow.com/questions/6468893/stash1-is-ambiguous
stash@{1} is ambiguous?

Your shell is eating your curly brackets, so while you say stash@{1}, git sees stash@1 and that makes no sense to it. Quote the argument (use git stash apply "stash@{1}") or reconfigure your shell to only expand curly brackets when there is a comma between them (zsh can be configured either way, bash only expands curly brackets with comma or range between them, other shells may behave one or other way).

实际上可以通过stash@{n}来获取stash,所以可以尝试git stash apply stash@{0}(注意:在shell中你需要引用stash@{0}
stash@{n}是你需要转换到的git的修订版本,但是如果使用git stash apply的话,你应该知道DTRT在你的位置应如何应用。
如果你是在Windows机器上和PowerShell中,需要引用以下参数。
在版本2.11中,你可以使用N堆栈而不是"stash@{n}",所以可以丢弃下面用法:
git stash apply "stash@{n}"
你还可以使用以下代码:
git stash apply n
自1.7.5.1版本后目录发生了一些更改,但这并不影响你对它的使用,但是你必须确保存储库不会更改你的工作目录,否则会返回以下错误:

error: Your local changes to the following files would be overwritten by merge:
        file
Please commit your changes or stash them before you merge.

在1.7.5.1的早期版本中,如果工作目录发生了更改,它将不能正常使用。

GIT发布说明:

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 一、常用git stash命令: 1、git stash 能够将所有未提交的修改(工作区和暂存区)保存至堆栈中,用...
    宇宙小神特别萌阅读 10,250评论 2 3
  • 简评:如果你用过一段时间的 Git,你可能会用过 Git stash 命令。它是 Git 最有用的功能之一。以下是...
    极小光阅读 14,275评论 1 15
  • 关于Git Stash的详细解释,适用场合:使用git的时候,我们往往使用branch解决任务切换问题,例如,我们...
    angeliur阅读 4,862评论 0 1
  • 原文链接 http://www.jianshu.com/p/0d6f06f1163b 简述 使用git的时候,我们...
    JJNile阅读 1,137评论 0 0
  • 缘起 今天在看一个bug,之前一个分支的版本是正常的,在新的分支上上加了很多日志没找到原因,希望回溯到之前的版本,...
    kangaroo_v阅读 6,584评论 1 1