Jes*_*son 244 git escaping git-stash
我刚刚升级了git.我是git版本1.8.3.
今天早上我试图在堆栈中取消一个更改.
我跑了git stash pop stash@{1}
,得到了这个错误.
__PRE__
我尝试了大约20多种变体以及使用apply
而不是pop
没有成功.改变了什么?其他人遇到这个吗?
Bob*_*ore 294
如前所述,花括号可能需要转义或引用,具体取决于您的操作系统,外壳等.
有关可能出错的一些详细提示,以及如何在各种shell和平台中解决它,请参阅" stash @ {1}是不明确的? ".
git stash list
git stash apply stash@{n}
Run Code Online (Sandbox Code Playgroud)
Vas*_*liy 165
你需要逃避大括号:
git stash pop stash@\{1\}
Run Code Online (Sandbox Code Playgroud)
Von*_*onC 67
如果您想确保不必处理语法的引号stash@{x}
,请使用Git 2.11(2016年第4季度)
请参阅Aaron M Watson()提交a56c8f5(2016年10月24日).(由Junio C Hamano合并- -在提交9fa1f90,2016年10月31日)watsona4
gitster
stash
:仅允许索引引用stashes而不是
stash@{n}
明确地引用" ",而是可以简单地引用为"n
".
大多数用户只通过他们在藏匿栈中的位置来引用存储(我在这里称之为"索引").典型stash(
stash@{n}
)的语法有点烦人且容易忘记,有时难以在脚本中正确转义.因此,通过简单地引用索引来处理存储的能力是可取的.
所以:
git stash drop 1
git stash pop 1
git stash apply 1
git stash show 1
Run Code Online (Sandbox Code Playgroud)
Rob*_*ker 50
在Windows Powershell上我运行这个:
git stash apply "stash@{1}"
Run Code Online (Sandbox Code Playgroud)
owe*_*mck 15
正如罗伯特指出的那样,引号可能对你有用:
git stash pop stash@"{1}"
Run Code Online (Sandbox Code Playgroud)
kso*_*all 10
如果以上都不起作用,存储区周围的引号可能对您有用:
git stash pop "stash@{0}"
Run Code Online (Sandbox Code Playgroud)
小智 10
首先检查列表:-
git stash list
Run Code Online (Sandbox Code Playgroud)
复制您想要从存储列表中弹出的索引
git stash pop stash@{index_number}
Run Code Online (Sandbox Code Playgroud)
例如。:
git stash pop stash@{1}
Run Code Online (Sandbox Code Playgroud)
版本 2.11+ 使用以下内容:
git stash list
git stash apply n
Run Code Online (Sandbox Code Playgroud)
n 是数量stash@{12}