threads / discuss / 35555

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

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

## tl;dr

2 messages between Dec 19, 2013 and Dec 19, 2013.

replies: 1people: 2as markdown or json

Eric Andrew Lewis· Dec 19, 2013, 22:38 UTC · lore

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.

e.g.

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

-- Eric Andrew Lewis

Jonathan Nieder· Dec 19, 2013, 23:17 UTC · re: Eric Andrew Lewis · lore

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

(cc-ing area experts) Hi,

Eric Andrew Lewis wrote:
Show 5 quoted lines
> 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. :/
Show 5 quoted lines
> 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

← back to recent threads