Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GIT stashed date

Tags:

git

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?

like image 723
Razor Avatar asked Apr 24 '14 08:04

Razor


2 Answers

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.

like image 181
sleske Avatar answered Oct 26 '22 13:10

sleske


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}

like image 42
ricab Avatar answered Oct 26 '22 13:10

ricab