Borrowed from The MYYN, these are the three places where to find config files:
- $GIT_DIR/config
- ~/.gitconfig (--global)
- $(prefix)/etc/gitconfig
Ok, imagine you globally set your email to niko.schwarz@gmail.com. Now, we make a new repo:
$ cd /tmp
$ mkdir try && cd try
$ git init
$ git config user.email niko.schwarz@s-i.ch
$ touch hi
$ git -add .
$ git commit -m 'bla'
Then, your user.email will be set to two values:
$ git config --list | grep niko.schwarz
user.email=niko.schwarz@gmail.com
user.email=niko.schwarz@s-i.ch
But if you look at the log, the email address will be set to the one specific to the repo:
$ git log | grep niko.schwarz
Author: Niko Schwarz <niko.schwarz@s-i.ch>
Signed-off-by: Niko Schwarz <niko.schwarz@s-i.ch>
Therefore, local beats global, which is the order in which the values are listed. Now, with a bit of a leap of faith, I'd indeed assume that git config --list shows things in an order that makes latter ones take precedence.