From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Boaz Harrosh <bharrosh@panasas.com>
Cc: Junio C Hamano <gitster@pobox.com>,
Steven Walter <stevenrwalter@gmail.com>,
git@vger.kernel.org, jeske@google.com
Subject: Re: [PATCH] cmd_reset: don't trash uncommitted changes unless told to
Date: Wed, 25 Jun 2008 11:16:20 +0100 (BST) [thread overview]
Message-ID: <alpine.DEB.1.00.0806251109380.9925@racer> (raw)
In-Reply-To: <48620C1A.6000509@panasas.com>
Hi,
just to add to Junio's comments:
On Wed, 25 Jun 2008, Boaz Harrosh wrote:
> Junio C Hamano wrote:
> > Steven Walter <stevenrwalter@gmail.com> writes:
> >
> >> @@ -225,6 +243,10 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
> >> if (reset_type == HARD && is_bare_repository())
> >> die("hard reset makes no sense in a bare repository");
> >>
> >> + if (reset_type == HARD && !force && index_is_dirty()) {
> >> + die("Uncommitted changes; re-run with -f to trash them");
> >> + }
> >> +
> >
> > Please don't. With your change, does the testsuite even pass?
> >
> > "reset --hard" has *ALWAYS* meant to be destructive --- discarding
> > potential local cruft is the whole point of the operation.
> >
>
> I was under the impression that --hard means working-directory-also
> as opposed to tree-and-index-only. Nothing to do with
> destructive-discarding.
But "reset" _means_ to discard something.
Frankly, we could introduce "git reset --hard --force --really
--really-i-mean-it --do-reset-the-fscking-working-directory-NOW", but I do
not think that it makes sense.
If you want to reset the working directory, you want to reset the working
directory. If you wanted to save the changes somewhere, you should have
done that. We have enough ways to do that.
> > Learn the lingo, and get over it.
>
> I did lern the lingo and got bitten.
Apparently not. So again, "reset --hard" means to reset HEAD, index and
working directory to the revision you pass (defaulting to the HEAD).
The fact that you do not lose the information which used to be HEAD, is
just a side-effect of Git storing all the revisions in one big graph. It
is _not_ implied by "reset", which, as I pointed out, means "re-set".
> there is:
> git-reset --clean - destructive-discarding any local changes
What would be a "nondestructive-discarding", /me wonders.
> git-reset --hard - move tree index and working directory to new head
That is not "git reset --hard".
"move" to a new head is called "switching branches" in Git lingo (and BTW
in many other SCM lingos, too, so you might just as well get used to it),
and it is another command: "git checkout <branch>".
Incidentally, a friend just told me that "checkout" is everything but
intuitive, and he would have preferred "git branch switch <branch>", but
then settled for my proposed "git branch --switch <branch>", which I did
not have time to implement yet, unfortunately.
Ciao,
Dscho
next prev parent reply other threads:[~2008-06-25 10:19 UTC|newest]
Thread overview: 100+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <willow-jeske-01l5PFjPFEDjCfzf-01l5V7wbFEDjCX7V>
[not found] ` <jeske@willow=01l5V7waFEDjChmh>
2008-06-24 1:47 ` why is git destructive by default? (i suggest it not be!) David Jeske
2008-06-24 17:11 ` Boaz Harrosh
2008-06-24 17:19 ` Boaz Harrosh
2008-06-24 19:08 ` Jakub Narebski
2008-06-24 20:04 ` David Jeske
2008-06-24 20:04 ` David Jeske
2008-06-24 21:42 ` Brandon Casey
2008-06-24 22:13 ` David Jeske
2008-06-24 22:13 ` David Jeske
2008-06-24 22:54 ` Theodore Tso
2008-06-24 23:07 ` Junio C Hamano
2008-06-25 2:26 ` Theodore Tso
2008-06-25 8:58 ` Jakub Narebski
2008-06-25 9:14 ` Junio C Hamano
2008-06-26 15:13 ` Brandon Casey
2008-06-24 22:21 ` Steven Walter
2008-06-24 22:21 ` [PATCH] cmd_reset: don't trash uncommitted changes unless told to Steven Walter
2008-06-24 22:31 ` Junio C Hamano
2008-06-25 9:12 ` Boaz Harrosh
2008-06-25 9:23 ` Junio C Hamano
2008-06-25 9:59 ` Boaz Harrosh
2008-06-25 10:16 ` Johannes Schindelin [this message]
2008-06-25 10:24 ` Matthias Kestenholz
2008-06-25 10:46 ` Anton Gladkov
2008-06-25 12:33 ` Johannes Schindelin
2008-06-25 14:49 ` [PATCH] cmd_reset: don't trash uncommitted changes unless toldto Craig L. Ching
2008-06-25 15:18 ` Anton Gladkov
2008-06-25 10:41 ` [PATCH] cmd_reset: don't trash uncommitted changes unless told to Johannes Sixt
2008-06-25 12:38 ` Johannes Schindelin
2008-06-25 13:51 ` Theodore Tso
2008-06-25 17:22 ` Junio C Hamano
2008-06-25 19:50 ` Theodore Tso
2008-06-25 20:04 ` Avery Pennarun
2008-06-25 20:11 ` Junio C Hamano
2008-06-25 20:22 ` Avery Pennarun
2008-06-25 20:48 ` Junio C Hamano
2008-06-25 20:58 ` Avery Pennarun
2008-06-25 21:24 ` Re* " Junio C Hamano
2008-06-25 21:34 ` Junio C Hamano
2008-06-26 1:26 ` Junio C Hamano
2008-06-25 20:37 ` Steven Walter
2008-06-25 20:38 ` Theodore Tso
2008-06-25 20:50 ` Junio C Hamano
2008-06-25 21:05 ` Theodore Tso
2008-06-25 21:35 ` Junio C Hamano
2008-06-26 5:16 ` Junio C Hamano
[not found] ` <20080627193325.6117@nanako3.lavabit.com>
2008-06-27 22:11 ` Junio C Hamano
2008-06-28 0:06 ` しらいしななこ
2008-06-28 22:32 ` しらいしななこ
2008-06-29 8:56 ` Junio C Hamano
2008-06-25 22:44 ` Petr Baudis
2008-06-26 1:59 ` Johannes Schindelin
2008-06-25 20:09 ` Junio C Hamano
2008-06-26 11:55 ` Björn Steinbrink
2008-06-26 12:07 ` Johannes Schindelin
2008-06-26 12:35 ` Björn Steinbrink
2008-06-26 15:55 ` Avery Pennarun
2008-06-26 17:49 ` Johannes Schindelin
2008-06-26 12:01 ` Matthieu Moy
2008-06-26 12:09 ` Johannes Schindelin
2008-06-26 12:23 ` David Kastrup
2008-06-25 13:19 ` Ian Hilt
2008-06-26 5:31 ` Andreas Ericsson
2008-06-26 16:15 ` Jon Loeliger
2008-06-25 5:29 ` Johannes Gilger
2008-06-25 8:57 ` why is git destructive by default? (i suggest it not be!) Boaz Harrosh
2008-06-24 18:18 ` Brandon Casey
2008-06-24 1:47 ` David Jeske
[not found] ` <willow-jeske-01l5PFjPFEDjCfzf-01l5V7wbFEDjCX7V@videotron.ca>
[not found] ` <willow-jeske-01l5cKsCFEDjC=91MX@videotron.ca>
2008-06-24 2:17 ` Nicolas Pitre
2008-06-24 3:18 ` David Jeske
2008-06-24 3:18 ` David Jeske
2008-06-24 8:14 ` Lea Wiemann
[not found] ` <willow-jeske-01l5PFjPFEDjCfzf-01l5ciVtFEDjCaD9@videotron.ca>
[not found] ` <willow-jeske-01l5e9cgFEDjCh3F@videotron.ca>
2008-06-24 4:03 ` Nicolas Pitre
2008-06-24 4:40 ` David Jeske
2008-06-24 4:40 ` David Jeske
2008-06-24 5:24 ` Jan Krüger
[not found] ` <1978205964779154253@unknownmsgid>
2008-06-24 5:20 ` Avery Pennarun
2008-06-24 6:35 ` David Jeske
2008-06-24 6:35 ` David Jeske
2008-06-24 7:24 ` Jeff King
2008-06-24 7:31 ` David Jeske
2008-06-24 8:16 ` Jeff King
2008-06-24 8:30 ` David Jeske
2008-06-24 9:39 ` Jakub Narebski
2008-06-24 8:30 ` David Jeske
[not found] ` <willow-jeske-01l5PFjPFEDjCfzf-01l5kv6TFEDjCj8S@brm-avmta-1.central.sun.com>
[not found] ` <willow-jeske-01l5lTEoFEDjCVta@brm-avmta-1.central.sun.com>
2008-06-24 10:01 ` Fedor Sergeev
2008-06-24 10:24 ` David Jeske
2008-06-24 13:13 ` Theodore Tso
2008-06-24 7:31 ` David Jeske
2008-06-24 7:54 ` Jakub Narebski
2008-06-24 8:08 ` David Jeske
2008-06-24 11:22 ` Jakub Narebski
2008-06-24 11:29 ` David Jeske
2008-06-24 12:19 ` Rogan Dawes
2008-06-24 12:35 ` Johannes Gilger
2008-06-24 12:46 ` Rogan Dawes
2008-06-24 11:29 ` David Jeske
2008-06-24 12:21 ` Jakub Narebski
2008-06-24 12:13 ` Jakub Narebski
2008-06-24 8:08 ` David Jeske
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=alpine.DEB.1.00.0806251109380.9925@racer \
--to=johannes.schindelin@gmx.de \
--cc=bharrosh@panasas.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jeske@google.com \
--cc=stevenrwalter@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox