rich22 rich22 - 9 months ago 80
Git Question

What is the difference between git config --list and cat .gitconfig?

What is the difference between them both? I'm learning in my tutorial that they give out the global configuration settings, but I'm not really sure what the difference between them is, and when I should use either.


git config --list will list all configurations currently visible (in the current directory)

It will list all the configurations, system wide at the top, followed by the global configuration (most often found under ~/.gitconfig), followed by the local configurations (if inside a git repository).

cat .gitconfig will most likely only work in your home directory (~/)

Additionally the format of the two will differ.

See the documentation of git config for more details.

I don't see a reason why not to use git config --list always.