Dynamic git config - Use diferent profiles per folder12 Mar 2020
Some times we need to use different git profiles to have meaningful commits signatures when we need to use work profiles or personal profiles.
You can do this if you use
git >= 2.13 with the rule
includeIf you can choose when to use a particular profile when
you are on a specific folder or subfolders.
To do that you need to modify the file
~/.gitconfig with this content:
And you should have a file like
~/.gitconfig-work (for this example) with this content:
You can add as many
includeIf as you need.
So now if you cd to any git project inside
~/Projects/Work your git config should be like this: