Git Mailing List Archive mirror
 help / color / mirror / Atom feed
From: Philip Oakley <philipoakley@iee.email>
To: Junio C Hamano <gitster@pobox.com>, Elsie Hupp <git@elsiehupp.com>
Cc: git@vger.kernel.org
Subject: Re: Multiple --global config workspaces?
Date: Tue, 11 Oct 2022 14:56:26 +0100	[thread overview]
Message-ID: <85046d94-fa83-db7b-df64-27cf928fd08e@iee.email> (raw)
In-Reply-To: <xmqqwn96x61t.fsf@gitster.g>

On 11/10/2022 06:50, Junio C Hamano wrote:
> Elsie Hupp <git@elsiehupp.com> writes:
>
>> I structure my cloned repositories based on the remote host, e.g.:
>>
>> ~/Repositories/github/cloned-repository-name
>> ~/Repositories/gitlab/other-cloned-repository-name
> The above is by definition not "global" (aka "per user").
>
> "--global" is for things that are of your personal preference, not
> "when I am working on this project, these settings apply" (which is
> suitable for "per repository").
>
> What you want is a way to say "when I am working on these projects,
> these settings apply".
>
> One way to do this would be to have
>
> 	[includeIf "gitdir:~/Repositories/github/"] path = $HOME/.githubconfig
> 	[includeIf "gitdir:~/Repositories/gitlab/"] path = $HOME/.gitlabconfig
>
> in $HOME/.gitconfig and then write in these two extra files that are
> conditionally included whatever settings you want to use for any and
> all repositories that come from GitHub or GitLab.
>
> $ git help config
>
> and look for Conditional includes, perhaps?
>
>
This use of "IncludeIf" for the Home/work case also came up in a recent
Git for Windows discussion
https://github.com/git-for-windows/git/discussions/4058

That discussion was about the trickiness of quoting when on the
different Windows terminals/shells as the config string gets passed
around (IIUC).

--
Philip

  parent reply	other threads:[~2022-10-11 13:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-11  3:06 Multiple --global config workspaces? Elsie Hupp
2022-10-11  5:50 ` Junio C Hamano
2022-10-11 13:13   ` Jeff King
2022-10-11 16:55     ` Elsie Hupp
2022-10-11 18:41       ` Elsie Hupp
2022-10-14 19:39       ` Jeff King
2022-10-15 10:56         ` Matthias Aßhauer
2022-10-15 18:14           ` Jeff King
2022-10-18  4:02         ` Elsie Hupp
2022-10-18 20:53           ` Jeff King
2022-10-20  2:29             ` Elsie Hupp
2022-10-20  2:39               ` Elsie Hupp
2022-10-11 13:56   ` Philip Oakley [this message]
2022-10-11  5:51 ` Reto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=85046d94-fa83-db7b-df64-27cf928fd08e@iee.email \
    --to=philipoakley@iee.email \
    --cc=git@elsiehupp.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).