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  [...] -- [...]'

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发布说明:

  • 说明2.11
  • 说明1.7.5.1

你可能感兴趣的:(git stash)