git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Erik Cervin Edin <erik@cervined.in>
Cc: Tim Chase <git@tim.thechases.com>,
	git@vger.kernel.org,
	Daryl Van Den Brink <daryl.vandenbrink@maptek.com.au>
Subject: Re: stashing only unstaged changes?
Date: Fri, 24 Jun 2022 17:32:23 +0200	[thread overview]
Message-ID: <220624.86czeyhy8x.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <CA+JQ7M8gaEWHHdx2or2kQfYpp=XBxQS=pXtEOS4x5SBdpPWdkQ@mail.gmail.com>


On Fri, Jun 24 2022, Erik Cervin Edin wrote:

> On Fri, Jun 24, 2022 at 3:20 PM Ævar Arnfjörð Bjarmason
> <avarab@gmail.com> wrote:
>>
>> Is what you want equivalent to:
>>
>>     # save the "git add -p"'d chunks
>>     git stash push --staged
>>     # save the "uncommitted"
>>     git stash push
>>     # pop the previously staged
>>     git stash pop --index stash@{1}
>>
>> ?
>
> Never noticed --staged before.
> I just tried to
>   seq 1 3 >> bar
> then git add -p to stage with 2 and 3
> followed by a git stash push --staged but that gave me the error
>
>> error: patch failed: bar:2
>> error: bar: patch does not apply
>> Cannot remove worktree changes
>
> But I'm guessing the command (and approach) work fine if the
> staged/unstaged are in different files.

Huh!

No, it does work when you stage chunks in the same file, I tested this
by modifying the top & bottom of our README.md.

But we do indeed have that error (which looks like an unrelated bug) if
you try to "git stash pust --staged" a hunk when that hunk overlaps with
changes that are unstaged.

  reply	other threads:[~2022-06-24 15:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-21 19:26 stashing only unstaged changes? Tim Chase
2022-06-24  8:16 ` Reto
2022-06-24 20:53   ` Tim Chase
2022-06-24  9:55 ` Konstantin Khomoutov
2022-06-24 11:23 ` Erik Cervin Edin
2022-06-24 20:38   ` Tim Chase
2022-06-24 13:09 ` Ævar Arnfjörð Bjarmason
2022-06-24 13:49   ` Erik Cervin Edin
2022-06-24 15:32     ` Ævar Arnfjörð Bjarmason [this message]
2022-06-24 19:47       ` Junio C Hamano

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: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=220624.86czeyhy8x.gmgdl@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=daryl.vandenbrink@maptek.com.au \
    --cc=erik@cervined.in \
    --cc=git@tim.thechases.com \
    --cc=git@vger.kernel.org \
    /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://80x24.org/mirrors/git.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).