Your Git Settings
The .gitconfig file.
All those git config commands write to one file, in your home folder, called dot git config. Let's look at it, and add a few settings that make life easier.

- git config writes to a file
- ~/.gitconfig
- A few useful settings
Useful settings
Init dot default branch main makes new repositories start with main. Core dot editor sets the editor Git opens, here VS Code. And pull dot rebase, which we met earlier. Cat shows they're all in the file, in neat sections.
git config --global init.defaultBranch main git config --global core.editor "code --wait" git config --global pull.rebase false cat ~/.gitconfig [user] name = Sam Lee email = sam@example.com [alias] st = status [init] defaultBranch = main [core] editor = code --wait [pull] rebase = false
Three levels
Settings can live at three levels. System, for every user on the computer. Global, for you, in your home folder. And local, for one repository, stored inside its dot git folder. The most specific one wins, so a local setting beats a global one.
| key | value |
|---|---|
| --system | every user |
| --global | you, ~/.gitconfig |
| --local | one repository |
| Wins | the most specific |
Summary
Your global settings live in dot git config in your home folder, and local settings beat global ones. Next, a few everyday gotchas, starting with line endings.
Key takeaways- ~/.gitconfig
- init.defaultBranch, core.editor
- local beats global