Adjusting your git email address per clone

I’ve been working a lot with git over the years. To that end, I commonly use my personal email address for projects I post on my github. Additionally, I have a project or two in which I participate. The email address I use there is just an alias to my personal email, but I want to use it instead of the email above.

Today, I came across an article that makes changing this value much, much simpler.  Try this:

$ git config --global alias.personal 'config user.email "herlo@personal"'
$ git personal
$ git config user.email
herlo@personal
$ git config --global alias.work 'config user.email "herlo@work"'
$ git work
$ git config user.email
herlo@work

As you can see, it’s now trivial to switch between certain email addresses. Man, git aliases are very nice!

Cheers,

herlo

Comments