Subject: Re: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes

From: Sean Whitton <[email-masked]>
Date: Thu, 22 Dec 2022 17:12:24 -0700

Hello,

On Wed 21 Dec 2022 at 01:45AM +02, Dmitry Gutov wrote:

> IIUC the --staged option is indeed limited to the very new Git, but that
> option is used when creating a stash (when we want to stash the staging area
> only).
>
> When restoring a stash, to reinstate the stashed index, you would use the
> option --index. It's older than --staged (e.g. it's available in Git 2.22.0,
> and that's as far back as the docs at git-scm.com/docs go). Not sure if it's
> in Debian Stable or not.

Ah, thanks for reminding me, I was getting mixed up.

Unfortunately it's probably not much use, because 'git stash push -- x'
stashes all staged changes, it turns out, not just those in x.

> Regarding the alternatives -- double stashing, or the Magit way, it's
> hard to form a strong opinion before examining them in detail (I trust
> you can make a good choice).
>
> For completeness, though, here's a way to implement 'git push --staged' with
> Git plumbing manually: https://stackoverflow.com/a/72582276/615245
>
> And as for a 'git pop --index' substitute, if the stash contains only the
> index area stuff, it might be as easy as
>
>   git diff stash@{0}^..stash@{0} > patch.diff
>   git apply --cached patch.diff
>   git stash drop

These references are helpful.  I'll investigate further.

-- 
Sean Whitton