Subject: Re: [Feature Request] Did you mean `git ...`? should ask user for feedback, not return to the prompt

From: Jonathan Nieder <[email-masked]>
Date: Thu, 19 Dec 2013 15:17:59 -0800

(cc-ing area experts)
Hi,

Eric Andrew Lewis wrote:

> Git is smart enough to realize when you make a spelling error and
> enter a non-existent git command. Since you probably do mean what it
> suggests, it follows that the user would want to immediately say “yes,
> I did want to do that,” rather than return to the command line to
> enter the command again.

Yeah, it's a real tease. :/

> e.g.
>
> $ git psh
> git: 'psh' is not a git command. See 'git —help'.
> Did you mean 'push'[y/n]?

This is a natural extension to the existing "ticking time bomb"
feature that can be enabled with

	echo '[help] autocorrect = 50' >>~/.gitconfig

Some value like "autocorrect = ask" could mean to prompt, and the
default behavior could be not to prompt (to avoid breaking muscle
memory for people used to the usual "just succeed or fail, don't
interact" behavior) but to mention that configuration in the output to
make it easy to discover.

With that tiny tweak, it sounds good to me.  I stole this idea from
http://thread.gmane.org/gmane.comp.version-control.git/197151/focus=197249
and the surrounding thread, which also has rough hints toward an
implementation.

Thanks and hope that helps,
Jonathan