git config --list
shows two values for user.name
, one global, one local:
user.name=My Name
...
user.name=My Other Name
...
My understanding is that local values override global ones. How can I get git config
to only show the values that are actually in effect? I only want to see one value of user.name -- the one that will be used if I commit in the current context.
If my question is based on a misunderstanding, or if this is caused by something wrong with my git install, that would also be very helpful.
git config --list
iterates through configuration entries, it does them in the same order that other Git commands see them. For settings likeuser.name
anduser.email
, the last setting is the one that is used. (A few items, such asremote.origin.fetch
, use all the settings.) To see the value that would be used for any particular item, you can rungit config --get <item>
. See Abhay Saraf's answer as well.git config --list
is not the right tool.--get
will just work.