For this we will use gitconfig file.

    cat ~/.gitconfig
# This is Git's per-user configuration file.
[user]
	name = lester
	email = PERSONAL_EMAIL_HERE

[core]
	editor = vim
	attributesfile = ~/.gitattributes

[includeIf "gitdir:~/develop/"]
	path = ~/.developconfig

[includeIf "gitdir:~/sideprojects/"]
	path = ~/.sideprojectsconfig

[push]
	default = simple

[init]
	defaultBranch = main

If we are inside develop folder, then we are going to use work config

    cat ~/.developconfig
[user]
	name = Lester
	email = COMPANY_EMAIL_HERE

If we are inside our side projects folder, we are going to use personal config

    cat ~/.sideprojectsconfig
[user]
	name = lesterzone
	email = PERSONAL_EMAIL_HERE