All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Organov <sorganov@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Elijah Newren" <newren@gmail.com>,
	"Gábor Farkas" <gabor.farkas@gmail.com>,
	"Git Mailing List" <git@vger.kernel.org>
Subject: Re: git switch/restore, still experimental?
Date: Thu, 06 May 2021 18:19:51 +0300	[thread overview]
Message-ID: <87k0obvqi0.fsf@osv.gnss.ru> (raw)
In-Reply-To: <xmqqk0oc1vzj.fsf@gitster.g> (Junio C. Hamano's message of "Thu, 06 May 2021 10:39:28 +0900")

Junio C Hamano <gitster@pobox.com> writes:

> Sergey Organov <sorganov@gmail.com> writes:
>
>> Isn't --merge a different (and inferior) way to achieve what we already
>> have elsewhere with --autostash? Does it make sense to get rid of --merge
>> here in favor of --autostash?
>
> Not really.

I tend to disagree. 

> The "--autostash" might appear to be applicable to cases that can
> induce larger conflict,

To me (auto)stash is not about amount of possible conflicts, and even
not about conflicts at all, but rather about data safety. (Auto)stash is
reversible: just get to original branch, apply the stash, and you are
basically back where you was.

Besides, --autostash shouldn't necessarily even imply --autorestore. I
can easily imagine a mode when --autorestore is fired only when one
returns to the branch where --autostash has been performed, leaving to
the user the responsibility of applying the stash to the new branch, if
she really needs it.

OTOH, --merge sounds more like infamous "cvs update". Keep fingers
crossed (or rather do a backup) and push the button, – Git will do its
best not to clobber your content, but all bets are off.

> but once the diversion gets larger than what one comfortably can deal
> with "checkout -m",

The problem is that I suspect there is no such margin. I'm simply
uncomfortable with -m. It doesn't sound safe to me no matter what. I'll
rather stash manually than use -m.

> the user is better off to work by forking a branch there and create a
> WIP commit, than deal with the stash.

Why? This looks like unjustified complication. All this is temporary
enough for the stash proper, – one just forgets about it immediately
most of times, as things typically go rather smooth anyway.

> So if anything, I'd rather get rid of "--autostash" than "-m", to help
> users get in a better work habit.

I have as much as 3 points to oppose to this:

1. Who decides which work habit is better? At the same time, data safety
and recovery are unprejudiced goals to be aimed at.

2. Unlike --merge, --autostash is universal. Whatever job is to be done,
get your changes to a safe place before continuing, to be able get them
back later. It'd be excellent if we had global autostash mode support,
especially if stash were capable to save/restore entire state of
everything. Sounds like "Undo" in text editors, or like automatic backup
before OS update.

3. Dunno about --merge, but I'm sure --autostash came from real life. I
see it all the time how users do "git stash; git pull; git stash pop"
sequence. It's just natural, and if it suits them, who are we to decide
what's "better" for them? I believe Git should continue to provide
convenient tools that help to get the job done, rather than trying to
fight "improper" habits and/or workflows.

Overall, to me --autostash is clear winner :)

That said, I somehow feel this has been already discussed to death when
--autostash was introduced.

Thanks,
-- Sergey Organov

  reply	other threads:[~2021-05-06 15:19 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-04 10:32 git switch/restore, still experimental? Gábor Farkas
2021-05-04 19:54 ` Felipe Contreras
2021-05-05  3:46 ` Elijah Newren
2021-05-05  4:01   ` Eric Sunshine
2021-05-05 11:09   ` Ævar Arnfjörð Bjarmason
2021-05-05 17:46     ` Felipe Contreras
2021-05-05 19:26       ` Sergey Organov
2021-05-05 19:48     ` Sergey Organov
2021-05-06  1:39       ` Junio C Hamano
2021-05-06 15:19         ` Sergey Organov [this message]
2021-05-06 10:05       ` Ævar Arnfjörð Bjarmason
2021-05-06 14:29         ` Sergey Organov
2021-05-06  2:16     ` Junio C Hamano
2021-05-06 10:02       ` Ævar Arnfjörð Bjarmason
2021-05-10 11:04         ` Ævar Arnfjörð Bjarmason
2021-05-10 18:27           ` Junio C Hamano
2021-05-06 11:00       ` Felipe Contreras
2021-05-06 15:26         ` Ævar Arnfjörð Bjarmason
2021-05-06 21:55           ` Felipe Contreras
2021-05-10 10:58             ` Ævar Arnfjörð Bjarmason
2021-05-11  7:15               ` Felipe Contreras
2021-05-05 14:18   ` Johannes Schindelin
2021-05-05 14:26     ` Randall S. Becker
2021-05-06  1:15       ` Junio C Hamano
2021-05-05 17:52     ` Felipe Contreras

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=87k0obvqi0.fsf@osv.gnss.ru \
    --to=sorganov@gmail.com \
    --cc=avarab@gmail.com \
    --cc=gabor.farkas@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=newren@gmail.com \
    /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.