Subject: Re: `git stash pop` UX Problem

From: Theodore Ts'o <[email-masked]>
Date: Wed, 26 Feb 2014 10:17:46 -0500

On Tue, Feb 25, 2014 at 11:12:10AM -0800, Junio C Hamano wrote:
> So, I tend to agree with you, while I do understand where "I want to
> know about what is in stash" is coming from (and that is why we do
> have "git stash list" command).

One thing that would be nice is if there was built-in "git stash list"
option which only shows the stash items which match the current
branch.  The discussion on this thread inspired me to create the
following:

#!/bin/sh

b=$(git symbolic-ref HEAD | sed -e 's;refs/heads/;;')
git stash list --pretty="%gd %cr on: %s" | grep "WIP on $b" | \
    sed -e "s/ WIP on $b: [0-9a-f]*//"

This results in:

stash@{0} 4 weeks ago on: mke2fs: add make_hugefile feature
stash@{1} 5 weeks ago on: e2fsck, mke2fs: enable octal integers in the profile/config file
stash@{2} 5 weeks ago on: e2fsck, mke2fs: enable octal integers in the profile/config file
stash@{3} 5 weeks ago on: mke2fs: optimize fix_cluster_bg_counts()
stash@{4} 8 weeks ago on: e4defrag: choose the best available posix_fadvise variant
stash@{5} 9 weeks ago on: e2image: add -c option to optimize file system copying for flash devices
stash@{6} 9 weeks ago on: e2image: clean up gcc -Wall and sparse nits
stash@{7} 9 weeks ago on: e2fsck: fix printf conversion specs in ea_refcount.c

(Yes, I have a lot of junk on my git stash; showing the relative time
is going to help my GC what I have left on my git stash list.)

Cheers,

						- Ted