All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tao Klerks <tao@klerks.biz>
To: git <git@vger.kernel.org>
Subject: Introduce "git stash --continue" and "git stash --abort"?
Date: Thu, 2 Jun 2022 18:40:09 +0200	[thread overview]
Message-ID: <CAPMMpohvKSgcL=X=Z=Wf7zHRr_Ghex5oZ4iUTgZL7XhHSWFi8g@mail.gmail.com> (raw)

Hi folks,

I've spent a little time trying to understand how git stash behaves,
and understanding the differences wrt how a "naive user" (eg me?)
would expect it to.

So far most of the differences are about defaults, eg:
* I would expect "git stash push" (or "git stash") to
"--include-untracked" by default
* I would expect "git stash pop" to include "--index" by default
* I would expect "git checkout" (or at least "git switch") to have an
"--autostash" option like "git rebase" and "git merge" do

There's one "bigger" thing though, that sounds like a whole project:
The behavior of "stash pop" in the case of conflicts is somewhat
traumatizing:

* My worktree is left in a "conflicted" state, and the only way to
"back out" seems to be some sort of "reset" (but good luck figuring
out which one, or how to revert the stash-based changes without
impacting any other uncommitted changes that I had in my worktree)

* If I "forge on", resolve the conflicts, and stage the conflicted
files... my stash stack still contains something that I didn't intend
it to, until/unless I remember to "git stash drop"... which is an
unsafe (non-idempotent / not-easily-reversible) operation...

I would expect that some sort of merge- or rebase-like "--continue or
--abort" facility would make this much easier to understand... but of
course I have no idea how one would go about doing that. I assume the
closest existing pattern would be "git cherry-pick", but I imagine I'm
missing lots of subtleties.

I understand Brian M. Carlson has been working on big changes around
stash export, and Victoria Dye has been working on Sparse Index
support, but I'm not aware of any other major ongoing work from
skimming the mailing list in the past months.

Is this kind of direction one that's been considered before? Are there
reasons why it's a bad idea?

Thanks,
Tao

             reply	other threads:[~2022-06-02 16:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-02 16:40 Tao Klerks [this message]
2022-06-02 18:30 ` Introduce "git stash --continue" and "git stash --abort"? Junio C Hamano
2022-06-03  8:29   ` Tao Klerks

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

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

  git send-email \
    --in-reply-to='CAPMMpohvKSgcL=X=Z=Wf7zHRr_Ghex5oZ4iUTgZL7XhHSWFi8g@mail.gmail.com' \
    --to=tao@klerks.biz \
    --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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.