DEV Community

Rudra Narayan
Rudra Narayan

Posted on

Maintaining multiple GitHub accounts with ease

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
gitfirst() {
    git config --global '' && git config --global 'mrprofessor'

# Set user 2 as current user
gitsecond() {
    git config --global '' && git config --global 'rudrabot'

# Print current user
gituser() {
    git config --global && git config --global

And that five minute I save every day from this hack..spends for...well I don't know.


This post was originally published on

Top comments (0)