2

Is there a direct way to list all key/value pairs in a section with git config? E.g., to list all entries under the core section.

I'm using git config --get-regexp <section-name>, but it seems kind of dumb—why use a regexp when I simply want all of the entries in a section.

On a related note, is there a way to list all configuration entries of the current checked out branch, without having to type in the name of the branch? (I.e. git config --get-regexp branch\.<branch-name>\.)

Anakhand
  • 2,838
  • 1
  • 22
  • 50

1 Answers1

1

Considering Git 2.22 (Q2 2019) introduced git branch --show-current, you can use:

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

But a regexp remain the way to list a config section.

Example:

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
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250