I use my personal laptop for work (they are fine with it) but I have noticed that all my work commits use my personal email address. I don't want to default to my work email address globally on my machine for git, is there a way that when I commit I can have my personal email address for some repos and my work email for others?
I'm not bothered about rewriting the history on the existing commits, just moving forward.
Yes, you can take advantage of --local
settings to precisely manage what email each repo should use.
# to set your work email only for the current repo
git config --local user.email '<your work email>'
# to set an email globally, as a fallthrough if a repo doesn't have a local setting for user.email
git config --global user.email '<your personal email>'