I've been googling about this, trying different methods from different sources... but it doesn't work.
I want to push commits with my personal profile (defined with "git config --global user.email ...") unless I'm on my work folder.
The content of my .gitconfig is located at C:/Users/my-user/
[user]
name = Personal
email = personal@personal.com
[includeIf "gitdir: F:/Work/CompanyName/"]
path = F:/Work/CompanyName/.gitconfig-work
Content of my .gitconfig-work is located at F:/Work/CompanyName/
[user]
name = Work
email = work@work.com
When I go to a cloned repository from work located at:
F:/Work/CompanyName/Project
I use:
git config --show-origin --get user.email
And it shows:
file:C:/Users/<my-user>/.gitconfig
Instead of the route I defined to work.
Thanks for your help.
✨ For the future googlers
I created a gist explaining the steps.