You can have conditional configuration based on path that you are in for git. For example if you have two emails defined one for work and one personal you can tell git to load gitconfig based on path you are in.
.gitconfig add the following lines:
[includeIf "gitdir:~/work/"] path = ~/work/.gitconfig
And then create a
.gitconfig file in the path above with whatever settings you need. A simple one would be to change the email of the user.
[user] email = "firstname.lastname@example.org"
Git will load this file also for all the subdirectories of the