DEV Community

Igor Santos
Igor Santos

Posted on

How to set different defaults for author and committer at git

Me, looking for a way to set different author and committer on Google: nowhere to be found
Me, looking for a way to set different author and committer on Google: nowhere to be found. Sad Igor was sad.

I wanted to have a default Committer that’s different from my default Author, as I need to differentiate commits made from my local and testing environments.

This is not as straight-forward as setting name/email at git, as there are no separate configuration entries for author and committer. However, it’s still possible if you override some environment variables, as follows: 
Example (at your ~/.bashrc or ~/.bash_profile):

GIT_COMMITTER_NAME=”Deploy server”
GIT_COMMITTER_EMAIL=”deploy@server.dev”
Enter fullscreen mode Exit fullscreen mode

In case you’ve forgotten/don’t know, you can set default name/user for git commits by editing ~/.gitconfig or running commands like these:

$ git config — global user.name “Igor Santos”
$ git config — global user.email “igor.santos@example.com”
Enter fullscreen mode Exit fullscreen mode

Top comments (0)