Chapter 3: Git Config

Git Config! ☕

This is one of those topics that feels boring at first (“just name and email, right?”), but once you understand it properly, it becomes your secret superpower. You’ll customize Git exactly how you like it, avoid 100 common frustrations, and look like a pro when someone asks “how did you make git log look so beautiful?”

Think of git config as Git’s settings menu — but way more powerful than any app settings page.

What does git config actually do?

It lets you read, set, change, or delete hundreds of tiny switches that control:

  • How Git behaves (line endings, compression, safety checks…)
  • How it looks (colors, log format…)
  • Your identity (who appears in commits)
  • Shortcuts (aliases like git lg for pretty log)
  • Default tools (editor, credential helper…)
  • Team conventions (default branch name, pull behavior…)

Git reads these settings from three layered levels (like onion layers — inner ones win).

The Famous 3 Levels of Git Config (2026 reality)

Level Flag File location (typical) Applies to … Who usually changes it? Precedence (who wins?)
System –system /etc/gitconfig (Linux) C:\ProgramData\Git\config (Windows) All users on this computer Admin / company IT Lowest (overridden by others)
Global –global ~/.gitconfig or ~/.config/git/config Windows: C:\Users\YourName\.gitconfig You — all your repositories You (99% of what you’ll touch) Medium
Local –local (default if inside repo) .git/config (inside your project folder) Only this one repository You — when project needs special rules Highest — overrides everything

Rule to remember forever: Local > Global > System (closest to the repo wins)

Real example – see it in action

Create a playground folder:

Bash

Now let’s set things at different levels.

  1. System level (rarely touched — pretend you’re admin)

    Bash

    → Affects every Git user on this machine (unless overridden)

  2. Global level (your personal defaults)

    Bash
  3. Local level (only this repo)

    Inside the repo folder:

    Bash

Now let’s see what’s really being used:

Bash

Typical output looks like this (example from a real setup):

text

See? The local user.name & email override the global ones — only for this repo!

Most Useful / Popular Settings (2026 edition)

Here are the ones almost every developer sets globally:

Bash

How to edit config files directly (sometimes easier)

Bash

It looks like this (INI format):

text

Quick Commands Cheat Sheet

What you want to do Command Example
See all settings (with source file) git config –list –show-origin
See only global git config –global –list
See only this repo git config –local –list
Get one value git config user.name
Set one value git config –global core.editor “nano”
Unset / remove one git config –global –unset alias.bad
Edit full file git config –global –edit
List all possible settings (huge!) git help –config

Mini homework – try right now!

  1. Run git config –list –show-origin → see what you already have!

  2. Add the pretty log alias:

    Bash
  3. In any repo, type git lg → beautiful branch graph!

Any part confusing?

  • Want to see how to fix line-ending hell on Windows?
  • Need help creating useful aliases?
  • Or shall we talk about credential helpers for GitHub login without typing password every time?

Just shout — we’ll keep going step by step. You’re getting really good at this! 🚀

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *