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

Re: ~/.git/config ?

From
Linus Torvalds <torvalds@osdl.org>
Date
May 27, 2006, 03:20 UTC
Message-ID
<Pine.LNX.4.64.0605262007230.5623@g5.osdl.org>
In-Reply-To
<20060527025750.GM11941@pasky.or.cz>
On Sat, 27 May 2006, Petr Baudis wrote:
> 
> ~/.gitrc might get useful for actually doing what ~/.cvsrc or ~/.cgrc
> does, that is providing default options for git commands. ~/.gitconfig
> would just give you per-user defaults for the repository config file.
I don't think the two are necessarily any different.
I do think that
 (a) we might as well use the same syntax. There's no point in having 
     different syntax for the files, even if they end up having slightly 
     different usage.
 (b) a "user-wide" config file would tend to have different things in it 
     than a per-repository one, but some of the things it would have in it 
     are the things that we currently put in the per-repository one. 
     Notably exactly the "user.name" and "user.email" values.
 (c) having a user- (and perhaps a system-) wide config file would make 
     some things that we do not _yet_ support in the .git/config file 
     format more natural, but that doesn't necessarily mean that having 
     them on a per-repo basis would be wrong either.

As an example of (c), let's say that somebody wants to use the CVS aliases with git. They've used cvs for years, and as a result their brain has atrophied, and they have a really hard time teaching their fingers to write "git commit" when they want to write "cvs ci".

So they would do "alias cvs git" in a desperate attempt to save themselves from CVS, and then add

	[alias "co"]
		cmd = commit -a

to their .gitrc file. Now, the only thing we'd need to do is to teach "git.c" to parse that simple "alias.$1.command" variable, and that really sounds pretty damn easy, no?

And that really does make more sense in a user-wide ".gitrc" file. But at the same time, there's really no reason to _disallow_ it from the repo-private .git/config file either. For example, you could do

	[alias "publish"]
		cmd = push public.site.com:/pub/scm/my-public-repo

and that is somethign that actually makes sense as a per-repository command alias, so that "git publish" does the right thing for just _that_ repository.

So I would argue that yes, ".gitrc" makes sense, and no, we shouldn't have a separate ".gitrc" and ".gitconfig", because I think what we really would want is a way to do default .git/config entries, and that it is _also_ a very natural way to add some things that we don't do yet.

			Linus

PS. I really like my [alias "cmd"] idea. _All_ my ideas are great, of course, but this one seems even better than some others. No?

Previous: Petr BaudisNext: Linus Torvalds
Message 9 of 19 in “~/.git/config ?”
  1. Anand KumriaMay 26, 2006
  2. Timo HirvonenMay 26, 2006
  3. Jakub NarebskiMay 26, 2006
  4. Petr BaudisMay 26, 2006
  5. Timo HirvonenMay 26, 2006
  6. Petr BaudisMay 26, 2006
  7. Pavel RoskinMay 27, 2006
  8. Petr BaudisMay 27, 2006
  9. Linus TorvaldsMay 27, 2006
  10. Linus TorvaldsMay 27, 2006
  11. Junio C HamanoMay 27, 2006
  12. Jakub NarebskiMay 27, 2006
  13. Junio C HamanoMay 27, 2006
  14. Nikolai WeibullMay 27, 2006
  15. Timo HirvonenMay 27, 2006
  16. Junio C HamanoMay 26, 2006
  17. Read configuration also from ~/.gitrcPetr Baudis, May 28, 2006
  18. Johannes SchindelinMay 29, 2006
  19. Jakub NarebskiMay 29, 2006

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.