{"thread":{"id":"44654","subject":"Feature request: read git config from parent directory","startedAt":"2016-12-08T19:50:16Z","lastAt":"2016-12-10T11:16:49Z","messageCount":3,"participants":["Dominique Dumont","Duy Nguyen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"307303","messageId":"3881793.6JIRvg1BPW@ylum","threadId":"44654","inReplyTo":null,"subject":"Feature request: read git config from parent directory","fromName":"Dominique Dumont","fromEmail":"dod@debian.org","sentAt":"2016-12-08T19:49:58Z","receivedAt":"2016-12-08T19:50:16Z","isPatch":false,"sender":{"key":"dod@debian.org","avatar":null},"body":"Hello\n\nI use the same machine for work and open-source contribution. In both cases, I \ndeal with a lot of repositories. Depending on whether I commit for work or \nopen-source activities, I must use a different mail address. I used to setup \nwork address for each work repo in git local config, but this is no longer \npractical.\n\nSince I use different directories for work and open-source, would it be \npossible for git to read irs config also from parent directories ? I.e. setup \ngit to read config from ./.git/config then ../.gitconfig, ../../gitconfig until \nglobal ~/.gitconfig.\n\nAll the best\n\n-- \n https://github.com/dod38fr/   -o- http://search.cpan.org/~ddumont/\nhttp://ddumont.wordpress.com/  -o-   irc: dod at irc.debian.org\n"},{"id":"307347","messageId":"CACsJy8AgbGXvMC0XWSPuBHEveJfJFEYUgghDC1Yc7Eka1Dyd8Q@mail.gmail.com","threadId":"44654","inReplyTo":"3881793.6JIRvg1BPW@ylum","subject":"Re: Feature request: read git config from parent directory","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2016-12-09T12:38:05Z","receivedAt":"2016-12-09T12:38:41Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Fri, Dec 9, 2016 at 2:49 AM, Dominique Dumont <dod@debian.org> wrote:\n> Hello\n>\n> I use the same machine for work and open-source contribution. In both cases, I\n> deal with a lot of repositories. Depending on whether I commit for work or\n> open-source activities, I must use a different mail address. I used to setup\n> work address for each work repo in git local config, but this is no longer\n> practical.\n\nSounds like the same problem I have (and the reason I came up with\nconditional include [1]). Would that work for you (check out the\nexample part in that patch)?\n\nIt's not supported yet. I'll need to address a few comments in the\nfuture reroll.\n\n[1] http://public-inbox.org/git/20160712164216.24072-1-pclouds@gmail.com/\n\n> Since I use different directories for work and open-source, would it be\n> possible for git to read irs config also from parent directories ? I.e. setup\n> git to read config from ./.git/config then ../.gitconfig, ../../gitconfig until\n> global ~/.gitconfig.\n-- \nDuy\n"},{"id":"307437","messageId":"4777019.UsV5sng9HM@ylum","threadId":"44654","inReplyTo":"CACsJy8AgbGXvMC0XWSPuBHEveJfJFEYUgghDC1Yc7Eka1Dyd8Q@mail.gmail.com","subject":"Re: Feature request: read git config from parent directory","fromName":"Dominique Dumont","fromEmail":"dod@debian.org","sentAt":"2016-12-10T11:16:38Z","receivedAt":"2016-12-10T11:16:49Z","isPatch":false,"sender":{"key":"dod@debian.org","avatar":null},"body":"On Friday, 9 December 2016 19:38:05 CET Duy Nguyen wrote:\n> >> Sounds like the same problem I have (and the reason I came up with\n> >> conditional include [1]). Would that work for you (check out the\n> >> example part in that patch)?\n> > \n> > If I understand correcly, I would need to set up config include in each\n> > git\n> > repository. This is as much work as setting up user.email in the same\n> > place.\n> \n> Well, no. You set this up in ~/.gitconfig. If you need to add some\n> settings in /abc/def/.gitconfig and expect repositories in this path\n> to reach it via the parent chain, then you could write something like\n> \n> [include \"gitdir:/abc/def/\"]\n> file = your-config-file\n> \n> in ~/.gitconfig and achieve the same effect, because all repos will\n> read ~/.gitconfig, and if it finds out the repo's location is inside\n> /abc/def, your-config-file will be loaded. It could contain email\n> settings or whatever.\n> \n> So, instead of spreading .gitconfig files around and relying on\n> parent-chain to reach them, you write a few filter rules in\n> ~/.gitconfig to tell all the repos what to load.\n\noh... yes, that would solve my problem and have no impact on other user who \ndon't need this feature. \n\nI do hope that the improvement you proposed will be merged.\n\nThanks for the explanation.\n\nAll the best\n\n-- \n https://github.com/dod38fr/   -o- http://search.cpan.org/~ddumont/\nhttp://ddumont.wordpress.com/  -o-   irc: dod at irc.debian.org\n"}]}