git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Alphabetize git config --list

From
Jeff King <peff@peff.net>
Date
May 28, 2012, 21:23 UTC
Message-ID
<20120528212309.GA4220@sigill.intra.peff.net>
In-Reply-To
<CAFus=5=cp62hpLM_Odog--Q0vER8kkT5Doqo28i-yZQyfvv4gQ@mail.gmail.com>
On Mon, May 28, 2012 at 01:58:28PM -0700, Zach wrote:
Show 5 quoted lines
> I was wondering if it would be possible to alphabetically order git
> config --list by default.
> 
> Essentially this
> $ git config --list | sort

No, it's not a good idea; the order of keys is important. For example, this config:

  [color]
    ui = true
    ui = false
is different than this:
  [color]
    ui = false
    ui = true

While that seems like a contrived example, consider something like a .git/config repo-specific config file overriding a user-wide ~/.gitconfig file. We do it by overwriting the old key.

There are also some "multi" values which accept multiple entries to create a list, and the list order may be relevant (I'd have to check, though; the only one that comes to mind is refspecs, and I don't know that order matters there).

-Peff
Previous: ZachNext: Michael Haggerty
Message 2 of 4 in “Alphabetize git config --list”
  1. ZachMay 28, 2012
  2. Jeff KingMay 28, 2012
  3. Michael HaggertyMay 29, 2012
  4. Jeff KingMay 29, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.