使用 git config 列出部分中的所有配置条目
List all configuration entries in section with git config
有没有一种直接的方法可以列出 git config
部分中的所有 key/value 对?例如,列出 core
部分下的所有条目。
我正在使用 git config --get-regexp <section-name>
,但它看起来有点笨——当我只需要一个部分中的所有条目时,为什么要使用正则表达式。
在相关说明中,有没有一种方法可以列出当前签出分支的所有配置条目,而无需输入分支名称? (即 git config --get-regexp branch\.<branch-name>\.
)
考虑到Git 2.22 (Q2 2019) introducedgit 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
有没有一种直接的方法可以列出 git config
部分中的所有 key/value 对?例如,列出 core
部分下的所有条目。
我正在使用 git config --get-regexp <section-name>
,但它看起来有点笨——当我只需要一个部分中的所有条目时,为什么要使用正则表达式。
在相关说明中,有没有一种方法可以列出当前签出分支的所有配置条目,而无需输入分支名称? (即 git config --get-regexp branch\.<branch-name>\.
)
考虑到Git 2.22 (Q2 2019) introducedgit 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