Let’s say I make a repo
cd repo1
git init
git config user.name "Jack"
git config user.email jack@hill.com
and then I make another
cd ../repo2
git init
git config --global user.name "Jill"
git config --global user.email jill@hill.com
Will I be Jack or Jill in repo1?
I assume that I’ll be Jack in repo1 if these 2 steps are done in the opposite order?
You will be Jack in
repo1, and Jill inrepo2, regardless of the order in which you run the commands. From thegit configman page:Git loads these files in that order. Your local repository’s,
.git/config, takes precedent over~/.gitconfig, which takes precedent over$HOME/.config/git/config, which takes precedent over/etc/gitconfig. Moreover:The
--globalflag doesn’t change every.git/configon your system, just~/.gitconfig.