links:


How to conditionally set git email based on directory?

I wanted to use different emails for work and personal and this guide will help to achieve that

With Condition includes you can configure git config conditionally

Create a file called .gitconfig under the directory you have to change email, usually work directory

[user]
	email = subramanya.chakravarthy@mutualmobile.com

Let’s assume this file is located at ~/Work/.gitconfig

Now open the main git config file at ~/.gitconfig and add the following

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

tags: git

sources: