How do you set committer identity per repository or per directory?
IntermediateConceptCommits, branches and tags
Answer
Set user.name and user.email locally, or use conditional includes in the global config so work and personal repos pick different identities automatically.
# ~/.gitconfig
[includeIf "gitdir:~/work/"]
path = ~/.gitconfig-work
More on Commits, branches and tags
How do you write a good commit message?BeginnerWhat is the difference between `git add .`, `git add -A` and `git add -u`?BeginnerHow do you commit only part of the changes in a file?BeginnerHow do you change the last commit message or add a forgotten file?BeginnerWhat is the difference between `git switch`, `git restore` and `git checkout`?BeginnerWhat is the difference between lightweight and annotated tags?Beginner