我在终端中使用 git 并且牢记我需要的大部分命令。因此,我想取消输出中的“帮助提示”,即括号中的所有文本以(use "git ...)开头,以使输出不那么冗长。
我知道标志--short和--porcelain,但是恕我直言,快速浏览时输出的可读性较差。
有没有办法保留输出的默认格式但没有帮助文本?
例子:
git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
Changes not staged for commit:
modified: file1.txt
modified: file2.txt
Untracked files:
untracked_file.txt
no changes added to commit
Run Code Online (Sandbox Code Playgroud)
... 代替 ...
git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
Changes not staged for commit:
(use "git add ..." to update what will be committed)
(use "git checkout -- ..." to discard changes in working directory)
modified: file1.txt
modified: file2.txt
Untracked files:
(use "git add ..." to include in what will be committed)
untracked_file.txt
no changes added to commit (use "git add" and/or "git commit -a")
Run Code Online (Sandbox Code Playgroud)
Git 通过在配置中使用“advice.*”键来提供启用/禁用建议。有关git help config更多信息,请参阅。存在以下 14 个变量:
advice.pushUpdateRejected
advice.pushNonFFCurrent
advice.pushNonFFMatching
advice.pushAlreadyExists
advice.pushFetchFirst
advice.pushNeedsForce
advice.statusHints
advice.statusUoption
advice.commitBeforeMerge
advice.resolveConflict
advice.implicitIdentity
advice.detachedHead
advice.amWorkDir
advice.rmHints
Run Code Online (Sandbox Code Playgroud)
您可以使用git config --global advice.*. 例如git config --global advice.statusHints false。请注意,我还没有看到一种同时禁用所有功能的方法。