From: Junio C Hamano <gitster@pobox.com>
To: "brian m. carlson" <sandals@crustytoothpaste.net>
Cc: Yuri <yuri@rawbw.com>, Git Mailing List <git@vger.kernel.org>
Subject: Re: Pressing Ctrl-C during 'git checkout <branch-name>' messes up the repository
Date: Sat, 15 Jul 2023 18:15:37 -0700 [thread overview]
Message-ID: <xmqqedl8lkqu.fsf@gitster.g> (raw)
In-Reply-To: <ZLM4sTUjBQt4QMfG@tapette.crustytoothpaste.net> (brian m. carlson's message of "Sun, 16 Jul 2023 00:24:17 +0000")
"brian m. carlson" <sandals@crustytoothpaste.net> writes:
>> When the user presses Ctrl-C, the correct action would be to cleanly return
>> to the initial branch.
>
> I would disagree here. When the user has hit Ctrl-C, they want to
> interrupt the operation. That's literally why a SIGINT (interrupt)
> signal is sent. A checkout can take a long time, and the user will not
> want Git to perform an operation which will take even longer than the
> original one (because the original checkout was aborted).
>
> Even if we did that, the user could just hit Ctrl-C again and really
> interrupt the process, and then they'd be stuck again.
>
> If you don't want to interrupt the operation, then don't hit Ctrl-C.
I agree with all of the above, but stopping with "don't" is not very
helpful---people do do things that they are told not to anyway, and
it makes a whole lot of difference if they know how to recover from
the fallout of their actions. It would help to teach "reset --hard"
or something that lets the user to return to a known state. It may
not necessarily be the state the user would want to go, but it is
still better to be in a known stable state and be able to complain
"I lost my stashed changes" or "I lost a few commits" than to be in
a state where the user is totally lost and do not know what to do
next.
Of course, that kind of coaching is not something we should do in
our error or advise messages, but in an early part of the tutorial
or somewhere, perhaps?
Thanks.
next prev parent reply other threads:[~2023-07-16 1:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-15 4:26 Pressing Ctrl-C during 'git checkout <branch-name>' messes up the repository Yuri
2023-07-16 0:24 ` brian m. carlson
2023-07-16 1:15 ` Junio C Hamano [this message]
2023-07-17 0:16 ` Yuri
2023-07-17 9:18 ` Konstantin Khomoutov
2023-07-17 16:35 ` Andreas Schwab
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=xmqqedl8lkqu.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=sandals@crustytoothpaste.net \
--cc=yuri@rawbw.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 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 NNTP newsgroup(s).