# git config --unset does not remove section

2 messages from 2012-10-21 to 2012-10-21. Participants: Angelo Borsotti, Junio C Hamano.
Thread: https://gitlist.dev/t/31881

## Angelo Borsotti, 2012-10-21 06:46

Subject: git config --unset does not remove section
Message-ID: <CAB9Jk9C_b_PScm3vEdvxsjqNHpTbz7OTTdFeFey7Sdb+M5gYFw@mail.gmail.com>
URL: https://gitlist.dev/e/CAB9Jk9C_b_PScm3vEdvxsjqNHpTbz7OTTdFeFey7Sdb%2BM5gYFw%40mail.gmail.com

```
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, 2012-10-21 07:09

Subject: Re: git config --unset does not remove section
Message-ID: <7v3918gv33.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v3918gv33.fsf%40alter.siamese.dyndns.org
In-Reply-To: <CAB9Jk9C_b_PScm3vEdvxsjqNHpTbz7OTTdFeFey7Sdb+M5gYFw@mail.gmail.com>

```
Angelo Borsotti <angelo.borsotti@gmail.com> writes:

> 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.

```
