Given the following stash content:
$ git stash list
stash@{0}: On fixes: animations-fixes
stash@{1}: WIP on master: 62aecaa Merge pull request #10 from SOURCE/branch-name
is there any way to have the same list, but including the date on which the stash was created?
A stash entry is just a regular git commit internally. So you can read its date ("commit date" or "author date") to know when it was created.
As mentioned in the manpage of git stash
, you can use the formatting options for git log
when invoking git stash list
. So to get the date, you could use git log
's option --format
:
git stash list --format="%gd: %ci - %gs"
This produces output like:
stash@{0}: 2014-04-23 11:36:39 +0500 - WIP on master: d072412 Do some stuff
That format uses %ci
, which prints the committer date in ISO 8601 format. Use %cr
for relative dates:
stash@{0}: 8 minutes ago - WIP on master: d072412 Do some stuff
See the manpage of git log
(section "PRETTY FORMATS") for more formatting options.
If you want just the date, without time, use
git stash list --format="%gd: %cd - %gs" --date=short stash@{0}
produces:
stash@{0}: 2017-09-22 - WIP on master: d072412 Do some stuff
%cd
means date formatted according to the --date=
parameter. stash@{0}
is necessary, or the stash id will be turned into a date too.
As others said, log
formatting applies. If you are looking for the default log format:
git stash list --pretty=medium
To see author and committer dates:
git stash list --pretty=fuller
And to inspect only one stash at a time (stash@{2}
in the example):
$ git log -1 --pretty=fuller stash@{2}