Search code examples
gitversion-controlzshzshrc

Changing Git user on the fly


I'd like to be able to switch the name and email in git, I tried this:

alias setup_diffuser='export GIT_COMMITTER_NAME="Blah" && export GIT_COMMITTER_EMAIL="blah@blah.com" && export GIT_AUTHOR_NAME="Blah" && GIT_AUTHOR_EMAIL="blah@blah.com" && export BLAH="true"'

but the name in the git commit is correct but the email is the one in ~/.gitconfig not the email in$GIT_AUTHOR_EMAIL How can I set the email on the fly like above without editing the ~/.gitconfig? I'm running git version 1.7.3.4


Solution

  • You forgot an export for GIT_AUTHOR_EMAIL :

    alias setup_diffuser='export GIT_COMMITTER_NAME="Blah" && export GIT_COMMITTER_EMAIL="blah@blah.com" && export GIT_AUTHOR_NAME="Blah" && export GIT_AUTHOR_EMAIL="blah@blah.com" && export blah="true"'