33

On git version 1.7.9.5, when trying

git stash show -p stash@{"Friday Smarch 13 13:13:13 2013"}

(from Is it possible to choose a git stash when they're described by the date stashed? )

I get the error message

Too many revisions specified: stash@{Friday Smarch 13 13:13:13 2013}

I also get the same error message when trying the following

git stash show "stash@{Friday Smarch 13 13:13:13 2013}"
git stash show -p stash@{Friday\ Smarch\ 13\ 13:13:13\ 2013}

I don't think escaping is the cause. If I do

git stash show -p stash@{Friday\ Smarch\ 13\ 13:13:13 2013}

Then I get a different error message:

fatal: ambiguous argument 'stash@{Friday Smarch 13 13:13:13': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions

By contrast, doing

git stash show -p stash@{42}

Works.

What does the error message mean, and what should I do?

Frederiko Ribeiro
  • 1,844
  • 1
  • 18
  • 30
Andrew Grimm
  • 78,473
  • 57
  • 200
  • 338
  • 1
    I tried simulating the your situation. I am also getting same error as you had got. However, git stash show -p --date=local, did work for me, without any errors. I do not know what the error mean! – Shunya Sep 19 '13 at 03:25
  • `git stash` simply hands the argument to `git rev-parse`. What does: `git rev-parse --no-flags --symbolic stash@{"Friday Smarch 13 13:13:13 2013"}` print? (Also, I'm curious, why "Smarch"?) – torek Sep 19 '13 at 06:02
  • @torek Smarch is the 13th month of the year. From Treehouse of Horror VI, The Simpsons. – Andrew Grimm Sep 19 '13 at 07:21
  • @torek, git rev-parse --no-flags --symbolic stash@{"Friday Smarch 13 13:13:13 2013"} gives the output : stash@{Friday Smarch 13 13:13:13 2013} – Shunya Sep 19 '13 at 08:09
  • @user1562655: That should give the "unknown revision" error, which makes sense (there's no rev associated with the nonexistent date with the lousy weather) ... it's the "too many revisions" one that does not. ... Aha, *my* `git rev-parse` gives that error, not that output! (Even if I build a 1.7.9.5 version) – torek Sep 19 '13 at 08:26
  • Ah, never mind previous comment, I've figured out how to trigger the problem. Interesting, it's because `git rev-parse` is ... overly generous and decides that if there is *some* stash@{anything} it can just print that as "close enough". But it has white space in it, so the `stash` script assumes that this resolved to multiple stash entries, and gives you the weird error. – torek Sep 19 '13 at 08:43

1 Answers1

116

This does not answer the OP's specific situation but I don't have enough reputation to add this as a comment... This page is one of the top search results for the error message Too many revisions specified

If you are using Posh Git or some other powershell command line then you get the above error message when you enter a command like

git stash show -p stash@{2}

Powershell doesn't like the curly braces.

git stash show -p stash@'{'2'}'

should do the trick.

Similarly:

git stash show -p "stash@{2}" 

also avoids the error.

Leon Bambrick
  • 26,009
  • 9
  • 51
  • 75
user1007074
  • 2,093
  • 1
  • 18
  • 22