RSS Amplifier

Scratchpad · Oct 10, 2022

Location aware config in git

0
Sign in to vote or save

This page cannot be shown here. You can still read it on the original site — the toolbar below keeps your place in the directory.

Something you should know about, because it is really useful: It is possible to change the (global) git configuration depending on the folder you are in. For example - when mixing work-related and private projects on the same machine: ~/.gitconfig : 1 2 3 4 5 6 [user] name = Some Name email = my.personal.address@example.org [includeIf "gitdir:~/code/work/"] path = ~/code/work/.gitconfig And then…

Something you should know about, because it is really useful:

It is possible to change the (global) git configuration depending on the folder you are in.

For example - when mixing work-related and private projects on the same machine:

~/.gitconfig:

1
2
3
4
5
6
[user]
    name = Some Name
    email = my.personal.address@example.org

[includeIf "gitdir:~/code/work/"]
    path = ~/code/work/.gitconfig

And then inside ~/code/work/.gitconfig:

1
2
[user]
    email = my.work.address@example.com

I rely on this daily - It is very useful!

So long!

Read on toor.su

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.