From: "Björn Steinbrink" <B.Steinbrink@gmx.de>
To: Theodore Tso <tytso@MIT.EDU>
Cc: Florian Weimer <fw@deneb.enyo.de>, git@vger.kernel.org
Subject: Re: What I miss from Cogito...
Date: Mon, 24 Mar 2008 02:40:30 +0100 [thread overview]
Message-ID: <20080324014030.GA24695@atjola.homenet> (raw)
In-Reply-To: <20080324001617.GB24943@mit.edu>
On 2008.03.23 20:16:17 -0400, Theodore Tso wrote:
> On Sun, Mar 23, 2008 at 08:14:47PM +0100, Florian Weimer wrote:
> >
> > Personally, I'm not all that happy with the multiple different meanings
> > of "git reset" and "git checkout", either. Depending on the parameters,
> > the two comments manipulate both the contents of the working copy, or
> > the location at which the working copy is hooked in the history. If we
> > need to have two separate commands for this, it would make more sense to
> > draw distinction between the two aspects, and not the mess we have now.
> > OTOH, it's probably too late for that.
>
> Yeah, it's not at all intuitive. I've been using git for quite some
> time and had *absolutely* *no* *idea* that "git checkout <treeish> --
> path" did what "bk revert" and "hg revert" does. In fact, I'm pretty
> sure I remember asking for this functionality a while back, and being
> told the right answer was "git show HEAD:pathname > pathname", and I
> kept on typing it until I got sick and tired of it, and so I created
> my short-hand shell script.
There is a difference between "checkout HEAD -- $file" and "show
HEAD:$file > $file". The former will also update the index, while the
latter does not. Maybe you asked for not updating the index back then?
Just guessing...
> And the fact that Peter was using "git reset --hard -- pathname" is
> another hint that it isn't at *all* obvious that "git checkout" does
> two completely different things, and it's not something that you're
> likely to intuit from the name or looking at the top-level git man
> page (where the summary in the top-level git manpage is, "checkout and
> switch to a branch").
Maybe it's just a misunderstanding on my side, but to me "checkout"
means as much as "get me something out of the repo". And git checkout
does exactly that. It can get you a branch (naturally switching your
HEAD to it), or it can get you trees or blobs. The latter can come from
either the index (default) or from a specific treeish. To say that you
want to revert your local changes is just the same as saying that you
want the file as it is in HEAD. And that's what git checkout gives you,
without introducing an extra command for that one special case.
> If we were going to separate the two commands out, I'd use the name
> "git revert-file", because that's what people who are coming from bk
> or hg are used to (where "revert" means to undo the local edits done
> to a particular file, as opposed to the git meaning of undoing a
> particular commit).
Nah, that would create confusion within git, because it does something
totally different from git revert. And checkout can also checkout a
whole tree, not just a file. So you would either need revert-tree as
well... Or add more confusion, because revert-file "reverting" a tree is
not quite intuitive.
Björn
next prev parent reply other threads:[~2008-03-24 1:41 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-23 17:15 What I miss from Cogito H. Peter Anvin
2008-03-23 17:38 ` Theodore Tso
2008-03-23 17:46 ` H. Peter Anvin
2008-03-27 2:36 ` Petr Baudis
2008-03-23 18:21 ` Luciano Rocha
2008-03-23 19:00 ` Mike Hommey
2008-03-23 19:07 ` Bruce Stephens
2008-03-23 19:07 ` Mike Hommey
2008-03-23 19:14 ` Florian Weimer
2008-03-24 0:16 ` Theodore Tso
2008-03-24 1:40 ` Björn Steinbrink [this message]
2008-03-24 2:14 ` Theodore Tso
2008-03-24 2:53 ` Junio C Hamano
2008-03-24 2:57 ` Björn Steinbrink
2008-03-24 3:06 ` [PATCH] Documentation/git-checkout: Update summary to reflect current abilities Julian Phillips
2008-03-24 16:49 ` Junio C Hamano
2008-03-24 3:06 ` Julian Phillips
2008-03-23 18:31 ` What I miss from Cogito Johannes Schindelin
2008-03-23 18:34 ` Junio C Hamano
2008-03-23 18:58 ` H. Peter Anvin
2008-03-23 18:59 ` Junio C Hamano
2008-03-23 19:16 ` Daniel Barkalow
2008-03-23 19:19 ` H. Peter Anvin
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=20080324014030.GA24695@atjola.homenet \
--to=b.steinbrink@gmx.de \
--cc=fw@deneb.enyo.de \
--cc=git@vger.kernel.org \
--cc=tytso@MIT.EDU \
/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).