git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Steven Grimm <koreth@midwinter.com>
Cc: Pierre Habouzit <madcoder@debian.org>, git@vger.kernel.org
Subject: Re: [PATCH] git-revert is one of the most misunderstood command in git, help users out.
Date: Mon, 05 Nov 2007 14:21:49 -0800	[thread overview]
Message-ID: <7vlk9cmiyq.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <CD2E6759-9E7E-41E6-8B58-AB6CA9604111@midwinter.com> (Steven Grimm's message of "Mon, 5 Nov 2007 11:28:03 -0800")

Steven Grimm <koreth@midwinter.com> writes:

> But that suggested command is not going to convince anyone they were
> wrong about git being hard to learn. I wonder if instead of saying, "I
> know what you meant, but I'm going to make you type a different
> command," we should make git revert just do what the user meant.
>
> There is already precedent for that kind of mixed-mode UI:
>
> git checkout my-branch
> vs.
> git checkout my/source/file.c

That's an example of mixed-mode UI, but what you are suggesting
is quite different, isn't it?

There is no other officially supported single-command-way to
checkout paths out of the index.  "git checkout paths..." does
not introduce a confusion because of that.  The user learns the
way git supports that concept and that's the end of the story.
The same thing can be said about "git checkout <commit>
paths...".  That's _the_ way to checkout paths out of an
arbitrary commit.

In the case being discussed, we already have the concept of
checking out paths from the index, which has an officially
supported way to express.

You are proposing to give it a synonym "git revert paths...",
which superfitially sounds friendlier.  But I actually think
allowing a mistaken

	git revert path...

to be burned to users' fingers and brains is doing the user a
great disservice.

The next person would say "Why doesn't 'git revert HEAD path...'
work?", and you would add the synonym to do 'git checkout HEAD
path...'.  Up to that point it is sort-of Ok (but not quite).
You already have "git checkout" that let's you do so, but you
introduced new concepts that are "revert paths to the index" and
"revert paths to the last commit".

Which may make you feel good, but you just introduced a narrower
synonym the user needs to learn, than a more established and
wider concept that we already have: "checkout paths out of X",
where X are either the index or an arbitrary commit.

The reason I think the narrower synonym is bad and will lead to
more user confusion is because after that point you will have
a few issues.

Another newcomer would say "I like the fact that 'git revert
HEAD path...' works but why doesn't 'git revert HEAD~12 path...'
work?".

 - You may further allow "git revert <arbitrary-commit>
   path...".  But what does that _mean_?  "revert the path to
   the twelfth commit"?  You may implement that _anyway_.

   Then, the user would say "eh, why do you have both 'git
   checkout path...' and 'git revert path...' that seem to do
   the same thing?  There's no difference?  Why Why Why, git is
   so hard to learn".

 - You may instead not to do so, and explain that the "arbitrary
   commit" form is not supported and tell the user to use "git
   checkout <commit> paths...".

   The user will say: "but you earlier told me to use revert --
   you could have taught me to use checkout from the beginning
   and saved me from great confusion instead".

Giving the same concept two different names is bad unless there
is a compelling reason to do so.  Labelling an initially
narrower subset of an existing concept with a different name,
and having to extended that 'new concept' ending up with the
same as the existing concept is even worse.

  parent reply	other threads:[~2007-11-05 22:22 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-05 19:01 [PATCH] git-revert is one of the most misunderstood command in git, help users out Pierre Habouzit
2007-11-05 19:04 ` Pierre Habouzit
2007-11-05 19:05   ` J. Bruce Fields
2007-11-05 19:10     ` Pierre Habouzit
2007-11-05 19:28 ` Steven Grimm
2007-11-05 19:50   ` Pierre Habouzit
2007-11-05 21:54   ` Alejandro Martinez Ruiz
2007-11-05 22:06     ` David Kastrup
2007-11-05 23:41       ` Alejandro Martinez Ruiz
2007-11-05 22:21   ` Junio C Hamano [this message]
2007-11-05 23:40     ` Johannes Schindelin
2007-11-06  0:08       ` Pierre Habouzit
2007-11-06  2:51       ` Junio C Hamano
2007-11-06  3:18         ` Johannes Schindelin
2007-11-06  4:54           ` Junio C Hamano
2007-11-06  8:49             ` Pierre Habouzit
2007-11-06  9:29               ` Mike Hommey
2007-11-06  9:37                 ` Pierre Habouzit
2007-11-06 12:32             ` Johannes Schindelin
2007-11-06 18:06               ` Junio C Hamano
2007-11-06 18:27                 ` Johannes Schindelin
2007-11-06 19:39                   ` Pierre Habouzit
2007-11-06 19:42                     ` Junio C Hamano
2007-11-06 22:21                       ` Johannes Schindelin
2007-11-06 20:06               ` Robin Rosenberg
2007-11-06 20:13                 ` Mike Hommey
2007-11-06 21:21                   ` Robin Rosenberg
2007-11-06 22:25                     ` Johannes Schindelin
2007-11-07  8:16                       ` Mike Hommey
2007-11-07 11:08                         ` Johannes Schindelin
2007-11-07 19:32                           ` Robin Rosenberg
2007-11-07 20:01                             ` Jakub Narebski
2007-11-07  9:03                       ` David Kastrup
2007-11-06 11:08         ` Junio C Hamano
2007-11-06 11:51           ` Johannes Sixt
2007-11-06 12:16             ` Johannes Schindelin
2007-11-06 12:25           ` Johannes Schindelin
2007-11-06 12:48             ` Pierre Habouzit
2007-11-06 17:43               ` Wincent Colaiuta

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=7vlk9cmiyq.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=koreth@midwinter.com \
    --cc=madcoder@debian.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 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).