Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git Commit Author's Email changing according to the directory and/or project?

Tags:

git

I work with my own projects and every-now-and-then I do some work for third-parties where I need to use their contact-information etc in commits. I usually use just global commit names etc but now I need to specify commit names and emails according to the directory. How can I do that in Git?

Perhaps useful relating information

  1. What is the difference between author and committer in Git?

  2. Git commit with no email

like image 932
hhh Avatar asked Jun 17 '12 05:06

hhh


Video Answer


1 Answers

You can have a per-repository username and email address that supercedes your global settings. It will affect commits made in the current repository, but not in other repositories.

git config user.name "Foo Bar"
git config user.email "[email protected]"

You can confirm that your local information is overriding your global defaults with:

git config -l | fgrep user.

It may show multiple entries (e.g both a global and a local configuration setting), but whatever is shown last in the list takes precedence.

like image 155
Todd A. Jacobs Avatar answered Oct 20 '22 18:10

Todd A. Jacobs