threads / discuss / 31881

git config --unset does not remove section

Subject: git config --unset does not remove section

## tl;dr

2 messages between Oct 21, 2012 and Oct 21, 2012.

replies: 1people: 2as markdown or json

Angelo Borsotti· Oct 21, 2012, 06:46 UTC · lore
Hello,

git config --unset does not remove the section in the configuration file when the removed key is the last one, leaving then an empty section that is lo longer used. E.g.:

    git config foo.bar true
creates:
    [foo]
	bar = true
then:
    git config --unset foo.bar
changes the section into:
    [foo]
Another git config foo.bar true changes the config file into:
    [foo]
    [foo]
	bar = true
Having two sections with the same name clutters the config file.
-Angelo Borsotti
Junio C Hamano· Oct 21, 2012, 07:09 UTC · re: Angelo Borsotti · lore

Re: git config --unset does not remove section

Angelo Borsotti <angelo.borsotti@gmail.com> writes:
Show 7 quoted lines
> Another git config foo.bar true changes the config file into:
>
>     [foo]
>     [foo]
> 	bar = true
>
> Having two sections with the same name clutters the config file.

True. It would be nice if the removal of the last element removes the section header as well.

← back to recent threads