Re: [PATCH] [RFC PATCH] stash save/push: add --index-only option

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

 



On Wed, Feb 12, 2020 at 11:04 PM Junio C Hamano <gitster@xxxxxxxxx> wrote:
>
> I am not sure if you explained how useful the "feature" being
> proposed is, which is a very important skill to exercise to entice
> readers to start reading and helping your code.
>
> Why is it useful to be able to do this?  It is unclear at least to
> me.

Fair enough. It's ok to explain here, right? There's no simple way to stash only
what you have on index while retaining your working tree state.

I would do this to achieve it:
save what I have on the index somehow
$ git commit -m "will drop this revision later"

that revision I just created has what I want to stash, actually

$ git stash save -m "want to keep this on working tree when I finish"

my work tree is now clean (perhaps with untracked files)

$ git reset soft HEAD~1 # get what I had on index before

now I can stash... this is what I originally intended

$ git stash save -m "what I really meant to stash"

and now I need to get the working tree the way I had it when I started:

git stash pop stash@{1}


All of that with git stash push --index-only... well, git stash push --cached

>
> By the way, per "git help cli", the name for this new option that is
> more in line with the rest of the system would be "--cached"; it
> would tell Git to work only on the data in the index (as opposed to
> the working tree files).
> .
>



[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