- Have different username/email settings for WORK or PERSONAL projects
- Uses the
includeIf
hack (unfortunately) - To get this to work (or test) the folder needs to have had
git init
already occur on it. - Hack the global
.gitconfig
file - Add separate
.gitconfig
files where you want have separate settings for different work / personal / serious-projects. - For Windows OS, you need to use case -INSENSITIVE- git command =>
gitdir/i
.. most examples say to usegitdir
but that fails on Windows OS.
- Create the work folder
> C:/Projects/Work/
- Create the file
.gitconfig
in this location. - Edit it with 'work' settings:
[user]
name = Work Name
email = work.email@something.com
- Follow steps 1->3 for personal stuff
> C:/Projects/Personal/
- Edit
~/.gitconfig
(note: this exists in the "home" folder, regardless of your OS) - Add the
includeIf
hack, per customization:
[user]
email = global.common@email.com
name = Global common name
[includeIf "gitdir/i:c:/projects/work/"]
path = c:/projects/work/.gitconfig
[includeIf "gitdir/i:c:/projects/personal/"]
path = c:/projects/personal/.gitconfig
- Test! enter a folder which has already been
git init
'd and type either/or:
git config --get-all user.email
git config -l --show-scope
If you see two emails listed, then you're good to go! and it should take the "included" one.