Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
803 views
in Technique[技术] by (71.8m points)

git - stash@{1} is ambiguous?

I'm trying to get info about my stash, but git is telling me that stash@{0} and stash@{1} are ambiguous. git stash list works fine, and .git/logs/refs/stash seems to have the appropriate content (not that I'm an expert on git internals).

% git stash list
stash@{0}: On master: two
stash@{1}: On master: one
% git stash show stash@{1}
fatal: ambiguous argument 'stash@1': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions

Just plain git stash show works fine. So why are the names that git stash list gives me considered ambiguous?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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 git stash apply stash@"{1}"; quoting either way will work) 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).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...