Git Config

submited by
Style Pass
2024-11-05 13:00:10

Git can change configuration depending on the directory you're in. By using this feature, you can create a directory structure with context-aware Git configurations.

Using includeIf in ~/.gitconfig:[include] path = "~/.config/git/main.gitconfig" [includeIf "gitdir:~/work/companyA/**"] path = "~/.config/git/companyA.gitconfig" [includeIf "gitdir:~/work/companyB/**"] path = "~/.config/git/companyB.gitconfig"

Here we everything under ~/work/companyA/ will get the git configuration from ~/.config/git/companyA.gitconfig, and similarly for companyB.Identity

Leave a Comment