4 ms·
You can have includeIf sections in your .gitconfig that applies only to things within a certain directory. So you if you create top level directories in your $H
by 0x0 3y ago
You can have includeIf sections in your .gitconfig that applies only to things within a certain directory. So you if you create top level directories in your $HOME for your various identities, all you need to do is to make sure you are cloning into and working within the appropriate directory hierarchy.
- mplewis9z 3y agoI do this to separate personal and company repositories on the same machine, and it works flawlessly. An example config looks like: ~/.gitconfig: ``` [includeIf "gitdir:~/Personal/"] path = ~/personal.gitconfig ``` ~/personal.gitconfig: ``` [user] email = {personal email address} ``` And you can have arbitrary numbers of "profiles" like this, as long as each is in their own directory.
- ziml77 3y agoOh that's really cool! I'm absolutely going to use this technique. Thanks both of you!