用git config列出本节中的所有配置条目

问题描述 投票:0回答:1

是否有直接方法可以用git config列出部分中的所有键/值对?例如,列出core部分下的所有条目。

[我正在使用git config --get-regexp <section-name>,但似乎有点愚蠢-为什么当我只想要一个节中的所有条目时为何使用正则表达式。

有关说明,是否有一种方法可以列出当前已检出分支的所有配置条目,而无需键入分支名称? (即git config --get-regexp branch\.<branch-name>\.

git git-config
1个回答
0
投票

考虑Git 2.22 (Q2 2019) introduced git branch --show-current,可以使用:

git config --get-regexp branch\.$(git branch --show-current)\.

但是正则表达式仍然是列出配置节的方式。

示例:

vonc@voncav MINGW64 /d/git/git (master)
$ git config --get-regexp branch\.$(git branch --show-current)\.
branch.master.remote origin
branch.master.merge refs/heads/master
branch.master.pushremote master next
© www.soinside.com 2019 - 2024. All rights reserved.