🔗 Change Your Git User Depending on the Current Directory with Conditional Includes

git terminal tooling

Git 2.13+ introduced Conditional Includes which allow to set the Git user name depending on the Git repo directory (and much more):

1
2
3
4
[includeIf "gitdir:~/code/"]
  path = .gitconfig-personal
[includeIf "gitdir:~/code/work/"]
  path = .gitconfig-work

— Example from Eric William


NOTE: This is just a summary of an 🔗 external link I shared.