git stashed

A quick 'n useful git tip:

$ git config --global alias.stashed "stash list --pretty=format:'%gd: %Cred%h%Creset %Cgreen[%ar]%Creset %s'"
$ git stashed
stash@{0}: 2d7f38b [19 minutes ago] On variable-travel-times-207: variable station travel times
stash@{1}: 1e4207e [6 weeks ago] WIP on custom-mission-actions-30-2: a00a646 Don't show intelligence since we're not using it.

Typically, git stash just shows you the items in your stash. Now, git stashed shows you how long ago an items was stashed (I had no idea I had a 6 week old stash item) and colorizes the relevant bits to make it easy to read (admittedly not visible in the bit above).


Good one! How can I remove or clean stashed work?

You can set the git prompt in your PS1 to show if you have anything stashed, assuming a reasonably up-to-date git install. Would help prevent that "didn't know I had a stash item sitting around" situation :)

What exactly is it, you are using that hash for? Is that hash in any way relevant?

@Dominic: Good call! That little dollar sign always makes me nervous when I see it.

(I had no idea I had a 6 week old stash item)


stash@{124}: a04c7ea [1 year, 9 months ago] On (no branch): nameservers tests


About Ovid

user-pic Freelance Perl/Testing/Agile consultant and trainer. See for our services. If you have a problem with Perl, we will solve it for you. And don't forget to buy my book!