本文介绍了" git config --list"显示重复的名字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

git config --list显示user.name的两个值,一个全局值,一个局部值:

git config --list shows two values for user.name, one global, one local:

user.name=My Name
...
user.name=My Other Name
...

我的理解是局部值会覆盖全局值.如何获得git config仅显示实际有效的值?我只想看到user.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.

如果我的问题是基于误解,或者是由于我的git install错误导致的,那也将非常有帮助.

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 2.8.0及更高版本中,您可以输入

On Git version 2.8.0 and above, you can type

git config --list --show-origin

显示单个配置条目的来源.

to show the origin of the individual configuration entry.

优先顺序为local> global> system.因此,本地配置将优先于全局配置.

Order of preference is local > global > system. So local configuration will be preferred over global if present.

这篇关于" git config --list"显示重复的名字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 17:42