5

I need a way to get a list of all default options that could be inserted into .gitconfig file

I don't mean going through all man pages :) more generic solution that could work for future versions would be most appreciated+

update: the closest I get to actual results is grep -r 'strcmp(var, ' ~/git-cource-code

update2: after 4 years (since version 2.19) git has the possibility of listing all possible config options (sadly without defaults :( )

Ochi
  • 1,468
  • 12
  • 18
  • You'd have to check out Git sourcecode. Have you? – CharlesB Feb 03 '14 at 10:42
  • I can `grep -r 'git config --get' .` in git source code but it's not great, not perfect and requires a lot of later work – Ochi Feb 03 '14 at 11:03
  • not great, sure, but not sure you have the choice... Ask on the Git ML to be sure – CharlesB Feb 03 '14 at 11:10
  • 1
    It seems there is no known way of getting the default values. The answer to a similar question might be helpful http://stackoverflow.com/questions/5991215/how-do-i-get-the-real-config-value-in-git – lemiorhan Feb 10 '14 at 12:02

2 Answers2

3

try git config --list for local repository or git config --global --list for global settings and git config --system --list for system wide settings

Also helpful info about GIT options http://nikedlab.com/tutorial/git-setup.html

NikedLab
  • 883
  • 4
  • 11
  • 31
  • https://www.kernel.org/pub/software/scm/git/docs/git-config.html If you see not in list option it means this option is not setted – NikedLab Feb 11 '14 at 12:07
0

It doesn't give you the default values, but you can list all the possibilities:

git help --config

To see valid values (super helpful for enums like blame.coloring for example)

man git-config

Has most of them. You can search for the one you want in less, or even just grep the output:

grep -A 10 -P blame.coloring <(man git-config)

Freedom_Ben
  • 11,247
  • 10
  • 69
  • 89