4 ms·
This is cool. In this specific case, you can also (1) not set the email in .gitconfig, and (2) set an environment variable `EMAIL`. Git will pick it right up.
by jcoder 5y ago
This is cool. In this specific case, you can also (1) not set the email in .gitconfig, and (2) set an environment variable `EMAIL`. Git will pick it right up.
I use direnv for this.
- siddharthgoel88 5y agoHmm, that is just about email. There can be other configs which we want to be different for work and personal. And having config in one file - like .work.gitconfig or .home.gitconfig looks better to me since I can find all the config at one place and do not need to look around all the places. However, that is a personal choice, I understand :-)
- jcoder 5y agoTotally, it’s a great solution. Using the env var is nice for the case where you only need to vary the email. Especially nice if you have multiple orgs to commit under, but the rest of your config is just how you like it for all projects.
- hardwaresofton 5y agodirenv is fantastic -- also good for setting a per-repository githook as well