There are some nuances. Took me a bit to piece it all together. 

1. Just add an if condition **at the end** of your _existing_ global `.gitconfig` at your root directory. 

```
[includeIf "gitdir:~/something/personal/"]
  path = .gitconfig-personal
[includeIf "gitdir:~/elsewhere/work/"]
  path = .gitconfig-work
```

The reason for adding at the end of your config, is because you want to _inherit_ everything that's in your existing config, but then just _override_ with some other directory based configurations.

**ATTENTION:** You must also add the `/` at the end of your directories. Otherwise things won't work.

2. Create and add whatever overrides you want into `.gitconfig-personal`, `.gitconfig-work`. For example mine is just: 

```
# .gitconfig-personal
[user]
	name = mfaani
	email = personalEmail@gmail.com
```

```
# .gitconfig-work
[user]
	name = Mohammad Faani
	email = workEmail@company.com
```



## How can I validate my settings? 

Either:
- Inspect existing repos: `git config --list | grep user.name` in different directories and inspect if things are different. 
- Inspect new repos: 
  - cd personal
  - git init Foo
  - cd Foo
  - git config user.name
  - compare its value if you did the same steps but from within /work directory