- Change your git config on your work laptop
- If you use a common gitconfig on multiple laptops, you can use the
includeIfdirective to change your git config on your work laptop - Settings you may want to change include:
user.nameuser.emaildefaultBranch
- In my case, I like to use my personal email address and
mainas the default branch on my personal laptop, but my work email address andtrunkas the default branch on my work laptop - To do this, I have the following in my
~/.gitconfig:[includeIf "gitdir:~/work/"] path = ~/.gitconfig-work - And the following in my
~/.gitconfig-work:[user] email = "YOUR EMAIL" [init] defaultBranch = trunk - You can also use
includeIfto change your git config based on the hostname of the machine you’re on - Need to add your work email address to your GitHub account? See this guide from GitHub
See /github-notifications-custom-routing/ if I want to also address how to route GitHub notifications to different email addresses
Inbox
- Git, GitHub and your work email • bitcrowd
- Does a good job of walking through why and how to use the
includeIfdirective to adapt your git config based on the machine you’re on - I like the use of code blocks to show the folder structure of the files being used before showing what’s in them
- I also like the break down of the context, then the git config step, then the GitHub steps
- Does a good job of walking through why and how to use the
- How to configure Git to commit using different emails for work and home repos — Flother
- Git Tips - Using Git with Multiple Email Addresses
- How to use different git emails for personal and work repositories on the same machine · Hao’s learning log
- Sending email notifications from GitHub organisations to different emails | Christian Heilmann
- Organizing multiple Git identities | Garrit’s Notes