2016-09-26 58 views
4

當我錯字一個git命令,如鍵入git git checkout myfile(注意額外的「混帳」)我得到以下的輸出:如何關閉git autocorrect?

WARNING: You called a Git command named 'git', which does not exist. 
Continuing under the assumption that you meant 'init' 
in 0.1 seconds automatically... 
usage: git init [-q | --quiet] [--bare] [--template=<template-directory>] [--shared[=<permissions>]] [<directory>] 

所以混帳假設我的意思是初始化,並給了我所有的0.1秒看它前進的錯誤。不是很酷的混帳!

如何關閉此「功能」?

回答

3

要查看自動更正的設定中,類型:

git config help.autocorrect

the docs

help.autocorrect實際上是代表十分之一秒的整數。所以如果你將它設置爲50,那麼在執行autocorrected命令之前,Git會給你5秒的時間來改變主意。

要關閉此功能,可使用命令:

git config --global help.autocorrect 0

0

注爲help.autocorrect默認值爲0

您還可以將其設置爲一個較大的值大於1:它使用十秒,所以10將是1秒,30將是3秒,依此類推。

請注意,啓動Git 2.14後,警告和繼續消息將會改變。
請參閱commit 968b1fe(2017年6月21日)作者:Marc Branchaud (``)
(在commit aca226eJunio C Hamano -- gitster --合併,2017年6月26日)

前,用help.autoCorrect = 15

WARNING: You called a Git command named 'lgo', which does not exist. 
    Continuing under the assumption that you meant 'log' 
    in 1.5 seconds automatically... 

後:

WARNING: You called a Git command named 'lgo', which does not exist. 
Continuing in 1.5 seconds, assuming that you meant 'log'.