I recently left a huge IT corporation for a promising startup.I was asked to change my GitHub handler name as it was too cool(I think) for them.Well instead of changing I created another account using my company email.
Now I got a problem.Every day when I come home and start hacking around my own projects I had to manually set my username and email id in git config in order to reflect my contributions in the graph and most of the time I forget to do so.
So I created some aliases to toggle between my two handles.
# Set user 1 as current user
git config --global user.email 'email@example.com' && git config --global user.name 'mrprofessor'
# Set user 2 as current user
git config --global user.email 'firstname.lastname@example.org' && git config --global user.name 'rudrabot'
# Print current user
git config --global user.name && git config --global user.email
And that five minute I save every day from this hack..spends for...well I don't know.
This post was originally published on rudra.dev