2

I'd like to have a default Committer that's different from my default Author, as I want to differentiate commits made from my local env and those from testing env. How do I do that?

igorsantos07
  • 4,456
  • 5
  • 43
  • 62

1 Answers1

3

By default, git considers as Author and Committer what's on your user.email and user.name config values - and there's no way to set that from config files.

However, both values can be overridden on a per-commit-basis using environment variables. Thus, if you set these in your shell settings you should be able to set a different committer, permanently.

Example (at your ~/.bashrc or ~/.bash_profile):

GIT_COMMITTER_NAME="Deploy server"
GIT_COMMITTER_EMAIL="deploy@server.dev"

Quick note: to set up author user/email use as follows (or write those entries directly in ~/.gitconfig if you know the file format):

$ git config --global user.name "Igor Santos"
$ git config --global user.email "igor.santos@example.com"
igorsantos07
  • 4,456
  • 5
  • 43
  • 62