Get the creation date of a stash

Try:

git stash list --date=local

It should print something like:

stash@{Thu Mar 21 10:30:17 2013}: WIP on master: 2ffc05b Adding resource

You can use --pretty=format to achieve this. For example, this produces a stash list that includes a relative time:

git stash list --pretty=format:"%C(red)%h%C(reset) - %C(dim yellow)(%C(bold magenta)%gd%C(dim yellow))%C(reset) %<(70,trunc)%s %C(green)(%cr) %C(bold blue)<%an>%C(reset)"

I have this set in the [alias] section of my ~/.gitconfig file, so that I can bind it to a simple sl command:

[alias]
        co = checkout
        lg = log --graph --pretty=format:\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset\" --abbrev-commit
        rl = reflog --pretty=format:\"%Cred%h%Creset %C(auto)%gd%Creset %C(auto)%gs%C(reset) %C(green)(%cr)%C(reset) %C(bold blue)<%an>%Creset\" --abbrev-commit
        sl = stash list --pretty=format:\"%C(red)%h%C(reset) - %C(dim yellow)(%C(bold magenta)%gd%C(dim yellow))%C(reset) %<(70,trunc)%s %C(green)(%cr) %C(bold blue)<%an>%C(reset)\"

(You can see that I also have similar markups for log and reflog)

Here's what it looks like: git stash list

If you want to show the actual date, rather than a relative time then replace %(cr) with %(ci).

Tags:

Git

Git Stash