3 ms·
I have the email address problem, but that's the only paramter that needs to vary. I use the simplest way of handling this, which is this in my .config/git/conf
by rkangel 3y ago
I have the email address problem, but that's the only paramter that needs to vary. I use the simplest way of handling this, which is this in my .config/git/config:
[user]
name = "My Name"
useConfigOnly = true
Then, the first time you commit in each repo, you'll get an "Author Identity Unknown" message. Then just run `git config --local user.email hello@example.com` to set the config for that repo.
- Tmpod 3y agoDidn't know about that, neat! I use multiple addresses as well and sometimes I forget to change when starting smth new. Not anymore :p
- simonkagedal 3y agoThis is what I’ve been doing for years, with some aliases to set work or personal. But honestly, I’ve started to find it annoying enough (for those first commits) to start wanting something else; yet still not annoying enough for me to research a different solution. Seeing this post, I’ll probably switch to the ”includeIf” way!
- jomar 3y agoThat is a nice trick. I've had my main email address in .config/git/config, added an override in ./.git/config for projects that need it, and checked who I am from time to time with [alias] whoami = "!f() { echo $(git config --get user.name)' <'$(git config --get user.email)'>'; }; f" but I might switch to your less error-prone approach.