Re: Can I remove multiple stashed states at a time?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 13, 2017 at 11:58:12AM +0900, 小川恭史 wrote:

> I want to remove multiple stashed states at a time.
> 
> But "git stash drop <stash>" removes only one stashed state at a time
> and "git stash clear" remove all.
> 
> Can I do that?

There isn't a way to do it through "git stash", I don't think. The stash
feature is backed by a reflog, and the underlying machinery is capable
of it. E.g.:

  git reflog delete --updateref --rewrite refs/stash@{1} refs/stash@{2} refs/stash@{3}

works. But that's getting a bit more familiar with the innards of stash
than users should be (both because they shouldn't need to, and because
the underlying storage may be subject to change).

Probably "git stash drop" should learn to take multiple stash arguments
and pass them all along to "reflog delete".

You can also just do:

  for i in 1 2 3; do
     git stash drop $i
  done

of course. It's less efficient than a single invocation (since it has to
rewrite the whole reflog each time), but unless you have thousands of
stashes, I doubt the difference is all that noticeable.

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux