From: Dmitry Gutov <dgutov@yandex.ru>
To: Sean Whitton <spwhitton@spwhitton.name>
Cc: 60126@debbugs.gnu.org, juri@linkov.net
Subject: bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes
Date: Wed, 21 Dec 2022 01:45:37 +0200 [thread overview]
Message-ID: <4910f545-d7b1-9f6b-8262-fd7fc89d589d@yandex.ru> (raw)
In-Reply-To: <87zgbh1xkn.fsf@melete.silentflame.com>
On 21/12/2022 01:10, Sean Whitton wrote:
> I tried implementing that, which is not hard, but then we pop that
> stash, the staged changes aren't restored to the index. The result is
> that if the user has a mixture of staged and unstaged changes to a file
> which is not part of the commit, then afterwards the unstaged changes
> will have been unstaged, mixed in with the staged changes again. In
> some circumstances this could constitute a loss of work.
>
> There are a few ways to overcome this. We can use the --staged option,
> but that's only available in very recent versions of git.
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.
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
next prev parent reply other threads:[~2022-12-20 23:45 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-16 18:32 bug#60126: 30.0.50; vc-git-checkin: Offer to unstage conflicting changes Sean Whitton
2022-12-17 17:06 ` Juri Linkov
2022-12-18 0:20 ` Sean Whitton
2022-12-18 1:08 ` Dmitry Gutov
2022-12-19 22:30 ` Sean Whitton
2022-12-20 0:53 ` Dmitry Gutov
2022-12-20 6:43 ` Sean Whitton
2022-12-20 13:47 ` Dmitry Gutov
2022-12-20 16:47 ` Sean Whitton
2022-12-20 15:13 ` Dmitry Gutov
2022-12-20 17:04 ` Sean Whitton
2022-12-20 23:10 ` Sean Whitton
2022-12-20 23:41 ` Sean Whitton
2022-12-20 23:45 ` Dmitry Gutov [this message]
2022-12-23 0:12 ` Sean Whitton
2022-12-23 3:59 ` Sean Whitton
2022-12-23 8:16 ` Eli Zaretskii
2022-12-24 2:03 ` Sean Whitton
2022-12-23 23:18 ` Dmitry Gutov
2022-12-24 2:02 ` Sean Whitton
2022-12-24 14:50 ` Dmitry Gutov
2022-12-24 18:22 ` Sean Whitton
2022-12-24 19:26 ` Dmitry Gutov
2022-12-24 20:10 ` Sean Whitton
2022-12-23 22:55 ` Dmitry Gutov
2022-12-20 17:13 ` Juri Linkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4910f545-d7b1-9f6b-8262-fd7fc89d589d@yandex.ru \
--to=dgutov@yandex.ru \
--cc=60126@debbugs.gnu.org \
--cc=juri@linkov.net \
--cc=spwhitton@spwhitton.name \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).