如何关闭git输出中的帮助提示?

时间:2019-04-01 21:31:21

标签: git

我在终端中使用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 

...而不是...

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")

1 个答案:

答案 0 :(得分:2)

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

您可以使用git config --global advice.*进行设置。例如git config --global advice.statusHints false。请注意,我还没有看到一种同时禁用所有功能的方法。