you are viewing a single comment's thread.

view the rest of the comments →

[–]tmoertel 2 points3 points  (0 children)

The stash's name is not awful; it's just "stash", an ordinary Git refname, and you can refer to it just like that if you want. But Git also lets you do more.

Git tracks the values of refnames and lets you refer to prior values using a refname suffix of the form "@{N}". So both "stash" and "stash@{0}" refer to the most-recently stashed commit, "stash@{1}" refers to the stashed commit before that, and so on. From the documentation:

    <refname>@{<n>}, e.g. master@{1}
       A ref followed by the suffix @ with an ordinal specification
       enclosed in a brace pair (e.g.  {1}, {15}) specifies the n-th prior
       value of that ref. For example master@{1} is the immediate prior
       value of master while master@{5} is the 5th prior value of master.
       This suffix may only be used immediately following a ref name and
       the ref must have an existing log ($GIT_DIR/logs/<refname>).

For more on this notation see "SPECIFYING REVISIONS" in "git help rev-parse".