Global git configuration with support for multiple accounts (e.g., work and personal).
These files are useful for automatically switching your global gitconfig (user email, name etc.) when you are using the same machine in multiple contexts. For example, working on personal projects, work projects etc.
Note: this has only been tested on macOS.
- Clone the repo.
- Copy all the files to your user directory (
~or/Users/<your-user-name>). - Edit the
.gitconfig-personaland.gitconfig-workfiles to replace your own email/user name details. - Edit the
.gitconfigfile. Replace<personal-projects/subpath>and<work-projects/subpath>with the parent folder or subpath to your personal and work projects.
A finished .gitconfig file might look like this:
[includeIf "gitdir:**/Projects/personal-projects/**"]
path = ~/.gitconfig-personal
[includeIf "gitdir:**/Projects/work-projects/**"]
path = ~/.gitconfig-workYou can also add more entries here and more .gitconfig-<whacky-stuff> files. As many as you'd like.