Git Config and Global Settings: The Complete Configuration Guide
Deep dive into Git's configuration system — .gitconfig, system/global/local scopes, aliases, essential settings, and production-ready defaults.
Git's three-tier configuration hierarchy lets you set defaults at system, global, and local scopes with precedence from most specific to least. Conditional includes (includeIf) automatically switch identity based on repository path, which is essential for managing work versus personal email on the same machine. Essential settings include push.default=simple for safe push behavior, pull.rebase=true for linear history, and fetch.prune=true to clean up stale remote tracking branches. Use git config --list --show-origin to debug where any setting originates.
Introduction
Git’s configuration system controls everything from your commit identity to merge behavior, from credential storage to diff algorithms. Most developers only scratch the surface — typing git config --global user.name and calling it done. But there’s more to it, and getting comfortable with the full system means fewer surprises when you’re in a hurry.
Git uses a three-tier configuration hierarchy: system-wide settings apply to every user on the machine, global settings apply to your user account across all repositories, and local settings apply only to a specific repository. This layered approach lets you set sensible defaults globally while overriding them for specific projects when needed.
This guide covers every aspect of Git’s configuration system: the file formats, scope resolution, essential settings, powerful aliases, and production-ready defaults that will save you hours of friction.
When to Use / When Not to Use
Configure Git globally when:
- You need the same identity and behavior across all projects
- You’re setting defaults for aliases, editors, and common commands
- You want consistent credential storage and line ending handling
Configure Git locally when:
- A project needs different identity (work vs personal email)
- Repository-specific settings differ from your defaults
- Team-wide conventions should only affect one project
Avoid over-configuring when:
- Settings are already sensible defaults — don’t change what works
- You’re guessing at options you don’t understand
- Using deprecated options — check
git config --helpfor current advice
Core Concepts
Git’s configuration lives in three places, each overriding the previous:
System scope (/etc/gitconfig or %PROGRAMFILES%\\Git\\etc\\gitconfig): Machine-wide. Rarely touched — only matters if you’re on a shared machine where an admin set defaults everyone inherits.
Global scope (~/.gitconfig or %USERPROFILE%\\.gitconfig): Your personal defaults. This is where identity, aliases, and day-to-day preferences live.
Local scope (.git/config inside each repository): Project-specific. Overrides everything else, but you rarely touch this directly.
graph TD
A[System Scope<br/>/etc/gitconfig] -->|Lowest Priority| B[Global Scope<br/>~/.gitconfig]
B -->|Medium Priority| C[Local Scope<br/>.git/config]
C -->|Higher Priority| D[Worktree Scope<br/>.git/worktrees/name/config]
D -->|Highest Priority| E[Effective Configuration]
F[git config --system] --> A
G[git config --global] --> B
H[git config --local] --> C
I[git config --worktree] --> D
When Git reads a configuration value, it checks local first, then global, then system. The first match wins — meaning local settings override global, which override system.
Configuration Resolution Flow
sequenceDiagram
participant Cmd as Git Command
participant Local as .git/config
participant Global as ~/.gitconfig
participant System as /etc/gitconfig
participant Result as Effective Value
Cmd->>Local: Check local scope
alt Value found
Local-->>Result: Use local value
else Not found
Local-->>Global: Check global scope
alt Value found
Global-->>Result: Use global value
else Not found
Global-->>System: Check system scope
alt Value found
System-->>Result: Use system value
else Not found
System-->>Result: Use compiled default
end
end
end
Configuration File Structure
graph LR
A[.gitconfig] --> B[Sections]
B --> C[user]
B --> D[core]
B --> E[alias]
B --> F[credential]
B --> G[push]
B --> H[merge]
C --> C1[name]
C --> C2[email]
D --> D1[editor]
D --> D2[autocrlf]
E --> E1[st = status]
E --> E2[co = checkout]
Step-by-Step Guide / Deep Dive
Reading Configuration
The most basic way to read configuration is git config --list. It prints all merged values from every scope. The output is useful but does not show where each value came from. Adding --show-origin prefixes each line with the file path or scope label (file:~/.gitconfig, file:.git/config, cmdline: for compiled defaults), so you can immediately see which config file provided each setting. If you want scope information instead of just origin, --list --show-scope adds a column showing whether each value is local, global, system, or worktree.
You can also query individual keys directly. git config --get user.email prints only the value that would be used, stopping at the first match in the resolution order. Use --get-all to see every value for a key that appears multiple times (such as when include directives add duplicates). For pattern matching, git config --get-regexp "user\\..*" returns all keys and values matching a POSIX regex. Git 2.36+ introduced --show-scope as a standalone flag that prints each value’s effective scope without needing the full --list output.
When you are debugging a configuration problem, the combination of --show-origin and --show-scope tells you exactly which file last set each value. You can also check specific scopes in isolation using git config --global --list, git config --local --list, or git config --system --list. These are especially handy in CI pipelines or deployment scripts where you want to confirm the right scope has the expected value before proceeding.
The git config --get command returns exit code 0 when a key is found and 1 when it is missing. In shell scripts, check that exit code instead of parsing the full configuration listing.
Writing Configuration
Every git config write example names its scope. --local changes this repository, --global changes your user config for repositories you use, and --system changes the machine-wide config. Examples that edit a file directly show the file path and scope in a comment.
# Set global values (most common)
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
# Set local values (overrides global for this repo only)
git config --local user.name "Work Name"
git config --local user.email "work@company.com"
# Set a system-wide value on Linux or macOS (requires administrator access)
sudo git config --system core.editor "vim"
# Remove a configuration value
git config --global --unset user.signingkey
# Edit the config file directly
git config --global --edit
Essential Global Settings
Identity
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
These are the only required settings. Git refuses to create commits without them — it won’t let you commit without an identity attached.
Default Editor
# VS Code
git config --global core.editor "code --wait"
# Vim
git config --global core.editor "vim"
# Nano
git config --global core.editor "nano"
# Sublime Text
git config --global core.editor "subl -n -w"
The --wait flag (or -w) tells Git to pause until you close the editor, so it can read the commit message you wrote.
Default Branch Name
git config --global init.defaultBranch main
Replaces the legacy master default. Set this once and all new repositories use main.
Push Behavior
git config --global push.default simple
The simple mode pushes the current branch to the remote branch with the same name, but only if the upstream is configured. This is the safest default and prevents accidental pushes to wrong branches.
Color Output
git config --global color.ui auto
Enables colored output for all Git commands when writing to a terminal. Set to always to force colors even when piping, or never to disable.
Line Endings
# Windows: convert LF to CRLF on checkout, CRLF to LF on commit
git config --global core.autocrlf true
# macOS/Linux: convert CRLF to LF on commit, no conversion on checkout
git config --global core.autocrlf input
# Alternative: disable autocrlf and use .gitattributes (recommended for teams)
git config --global core.autocrlf false
Credential storage
Choose a helper that is installed and supported by your operating system. Git’s helper list documents the platform options; Git Credential Manager supports Windows, macOS, and Linux when installed.
# macOS: use the Keychain helper included with macOS Git
git config --global credential.helper osxkeychain
# Windows: use Git Credential Manager if installed
git config --global credential.helper manager
# Linux: use libsecret only when it is installed
git config --global credential.helper libsecret
# Temporary fallback: keep credentials in memory for one hour
git config --global credential.helper 'cache --timeout=3600'
Do not use credential.helper store for passwords or access tokens. It writes credentials in plaintext to ~/.git-credentials. Keep tokens out of .gitconfig and command history too. See the Git credential helper reference and Git Credential Manager installation guide.
Powerful Aliases
Aliases are shorthand for longer Git commands. They are stored in the [alias] section of your config.
# Essential aliases
git config --global alias.st "status"
git config --global alias.co "checkout"
git config --global alias.br "branch"
git config --global alias.ci "commit"
git config --global alias.df "diff"
git config --global alias.lg "log --oneline --graph --all"
git config --global alias.ll "log --oneline --graph --all -20"
git config --global alias.last "log -1 HEAD"
git config --global alias.unstage "reset HEAD --"
# DESTRUCTIVE: rewrites the latest commit; use only on unshared history
git config --global alias.amend "commit --amend"
git config --global alias.fp "fetch --prune"
git config --global alias.pl "pull --rebase"
git config --global alias.ps "push"
# Advanced aliases
git config --global alias.graph "log --graph --oneline --decorate --all"
git config --global alias.hist "log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short"
git config --global alias.tips "log --oneline --graph --all --since='2 weeks ago'"
git config --global alias.who "shortlog -sne"
git config --global alias.count "rev-list --count HEAD"
git config --global alias.root "rev-parse --show-toplevel"
After setting these, you can use git st instead of git status, git lg for a visual log, and git hist for detailed history.
Production-Ready .gitconfig
This example is for ~/.gitconfig, your global configuration, so these settings apply across repositories. Remove or change any entry that does not fit your setup:
# ~/.gitconfig (global scope)
[user]
name = Your Name
email = your.email@example.com
signingkey = YOUR_GPG_KEY_ID
[core]
editor = code --wait
autocrlf = input
excludesfile = ~/.gitignore_global
pager = less -FRX
whitespace = trailing-space,space-before-tab
[init]
defaultBranch = main
[push]
default = simple
autoSetupRemote = true
[pull]
rebase = true
[fetch]
prune = true
[color]
ui = auto
branch = auto
diff = auto
status = auto
[alias]
st = status -sb
co = checkout
br = branch
ci = commit
df = diff
lg = log --oneline --graph --all
ll = log --oneline --graph --all -20
hist = log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
last = log -1 HEAD
unstage = reset HEAD --
# DESTRUCTIVE: rewrites the latest commit; use only on unshared history
amend = commit --amend
fp = fetch --prune
pl = pull --rebase
ps = push
graph = log --graph --oneline --decorate --all
who = shortlog -sne
count = rev-list --count HEAD
root = rev-parse --show-toplevel
diff-staged = diff --staged
# DESTRUCTIVE: rewrites the latest local commit; avoid shared history
undo = reset --soft HEAD~1
[credential]
helper = cache --timeout=3600
[commit]
gpgSign = true
verbose = true
[merge]
tool = vscode
conflictstyle = diff3
[mergetool "vscode"]
cmd = code --wait $MERGED
[diff]
tool = vscode
algorithm = histogram
[difftool "vscode"]
cmd = code --wait --diff $LOCAL $REMOTE
[help]
autocorrect = 10
[rerere]
enabled = true
Production Failure Scenarios
| Scenario | Impact | Mitigation |
|---|---|---|
| Wrong email in global config | Commits attributed to wrong identity, broken contribution graphs | Verify with git config --global user.email; use local overrides for work repos |
Corrupted .gitconfig syntax |
Git commands fail with parse errors | Backup before editing; use git config --global --edit which validates syntax |
| Conflicting settings across scopes | Unpredictable behavior, hard to debug | Use git config --list --show-origin to identify which scope provides each value |
| Missing GPG signing key | Signed commits fail, CI checks reject unsigned commits | Generate GPG key first, then set commit.gpgSign; verify with git log --show-signature |
| Autocrlf mismatch between team members | Constant line ending conflicts in PRs | Standardize on .gitattributes with * text=auto instead of relying on core.autocrlf |
| Credential helper expires or fails | Authentication errors during push/pull | Re-authenticate; check keychain/credential manager; rotate tokens if expired |
Trade-off Analysis
| Setting | Option A | Option B | Trade-off |
|---|---|---|---|
push.default |
simple (safe) |
current (convenient) |
simple prevents accidental pushes; current pushes without upstream setup |
pull.rebase |
true (clean history) |
false (preserves merge commits) |
Rebase creates linear history but rewrites commits; merge preserves true history |
core.autocrlf |
true (Windows) |
input (Unix) |
Platform-specific; .gitattributes is more portable |
credential.helper |
OS keychain or Git Credential Manager | cache (memory, temporary) |
Prefer an installed keychain helper; cache expires and may prompt again. store writes plaintext and should not hold passwords or tokens. |
commit.gpgSign |
true (verified) |
false (fast) |
Signing adds security overhead but proves authorship |
fetch.prune |
true (clean) |
false (preserves refs) |
Pruning removes stale remote-tracking branches but loses local references |
Implementation Snippets
Conditional Configuration (Git 2.13+)
The following examples edit global config files: ~/.gitconfig and the two included ~/.gitconfig-* files. Git supports conditional includes based on the repository path or remote URL:
# ~/.gitconfig
[includeIf "gitdir:~/work/"]
path = ~/.gitconfig-work
[includeIf "gitdir:~/personal/"]
path = ~/.gitconfig-personal
# ~/.gitconfig-work
[user]
email = you@company.com
name = Your Work Name
# ~/.gitconfig-personal
[user]
email = you@gmail.com
name = Your Personal Name
This automatically switches your identity based on which directory the repository lives in.
Global .gitignore
# Create the global ignore file at ~/.gitignore_global
cat > ~/.gitignore_global << 'EOF'
# OS files
.DS_Store
Thumbs.db
desktop.ini
# Editor files
.vscode/
.idea/
*.swp
*.swo
*~
# Build artifacts
dist/
build/
*.o
*.pyc
__pycache__/
node_modules/
# Environment files
.env
.env.local
.env.*.local
# Logs
*.log
npm-debug.log*
# OS-specific
*.orig
EOF
# Tell Git to use it
git config --global core.excludesfile ~/.gitignore_global
Rerere (Reuse Recorded Resolution)
Rerere watches how you resolve merge conflicts and remembers the outcome. The next time the exact same conflict shows up — same file, same conflicting lines — Git replays your recorded resolution automatically instead of making you fix it again. This comes in handy on long-lived feature branches that rebase onto main every few days; resolve a conflict once, and rerere handles it on every subsequent rebase.
The resolution cache lives in .git/rr-cache/, organized by conflict signature. Each subdirectory has a postimage file (the resolved version) and optionally a preimage (the original conflicted version). You can see what rerere has recorded with ls .git/rr-cache/, and you can wipe the whole cache with git rerere clear if the resolutions have gone stale.
A few edge cases: rerere only activates during merge and rebase, not during a bare git rebase onto a stacked branch. If the conflicting lines change enough between occurrences, the signature no longer matches and rerere stays silent — it will not apply a resolution that no longer fits the context. Rerere does not prevent conflicts; it only reduces the manual work when the same conflict repeats. Since Git 2.18, rerere is stable enough to enable globally.
# Enable globally
git config --global rerere.enabled true
# Or per-repository
git config --local rerere.enabled true
# View recorded resolutions
ls .git/rr-cache/
# Clear recorded resolutions
git rerere clear
Custom Log Formats
Git’s log formatting has two main modes. --pretty=format gives you full control over every field and supports color escape codes; --format is just a shorthand alias for the same thing. The format string accepts placeholders like %h (short commit hash), %H (full hash), %an (author name), %ae (author email), %ad (author date), %s (subject), %b (body), and %d (ref names like branch or tag decorations). Add --date=short or --date=relative to control the date format.
Color is applied via %C(...) escapes: %C(reset), %C(red), %C(green), %C(yellow), %C(blue), and a few others. The pattern is %C(color)placeholder%C(reset) to color a single field and then reset. Try these three formats:
# Compact graph log (good for daily use)
git config --global alias.lg "log --oneline --graph --all"
# Detailed history with author and date
git config --global alias.hist "log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short"
# Colorized full detail with branch decoration
git config --global alias.detailed-log "log --pretty=format:'%C(red)%h%C(reset) - %C(yellow)%ad%C(reset) %C(green)%s%C(reset) %C(blue)[%an]%C(reset)%C(red)%d%C(reset)' --date=short --graph"
# Usage: git detailed-log
Observability Checklist
- Logs: Use
git config --list --show-originto trace where every setting comes from - Metrics: Track which Git version your team uses — outdated versions lack security fixes
- Traces: Run
GIT_TRACE_SETUP=1 git statusto see which config files Git reads - Alerts: Monitor for
warning: core.autocrlfmessages indicating line ending conflicts - Audit: Review
~/.gitconfigquarterly for stale credentials, deprecated options, or identity drift - Health: Run
git config --global --get-regexp aliasto verify all aliases resolve correctly - Validation: Test new config options in a scratch repository before applying globally
Security & Compliance Considerations
- Commit signing: Enable GPG or SSH signing (
commit.gpgSign = true) to cryptographically verify commit authorship. This is required for many compliance frameworks - Credential storage: Never store passwords or tokens in plaintext.
credential.helper storewrites to~/.git-credentialswithout encryption; use an installed OS keychain helper or Git Credential Manager instead. - SSH key configuration: Store SSH keys in
~/.ssh/with600permissions. Use Ed25519 keys (ssh-keygen -t ed25519) for better security than RSA - Sensitive data in config: Keep passwords, tokens, and API keys out of
.gitconfig, shell history, and logged environment variables. Use an approved credential helper or secret store. - Auditing: The
user.emailin commits becomes permanent public history. Use a no-reply email (e.g.,user@users.noreply.github.com) for open source contributions to protect privacy
Common Pitfalls / Anti-Patterns
- Editing
.gitconfigmanually without understanding INI syntax: Missing brackets or incorrect indentation causes parse errors. Usegit config --global --editwhich opens the file with proper formatting - Setting
core.autocrlfinconsistently across team members: One person ontrue, another onfalseguarantees line ending conflicts. Standardize on.gitattributes - Overusing aliases: Creating aliases for commands you rarely use adds cognitive load. Only alias commands you type multiple times per day
- Forgetting the scope: If you omit a scope option, Git writes to the current repository’s local config. State
--local,--global, or--systemso the effect is clear. - Not using conditional includes: Managing work and personal identities manually leads to accidental commits with the wrong email. Use
includeIfdirectives - Ignoring
push.autoSetupRemote: Without this, every new branch requiresgit push -u origin branch. Settingpush.autoSetupRemote = trueautomates this
Quick Recap Checklist
- Git has three configuration scopes: system, global, and local
- Local overrides global, which overrides system — first match wins
-
user.nameanduser.emailare the only required settings - Use
git config --list --show-originto debug configuration issues - Aliases save time for frequently used commands
-
push.default simpleis the safest push behavior -
pull.rebase truecreates cleaner, linear history - Conditional includes (
includeIf) automate identity switching - Commit signing (
gpgSign) provides cryptographic authorship proof - A global
.gitignoreexcludes common files across all projects -
rerere.enabled trueremembers merge conflict resolutions - Never store plaintext credentials in
.gitconfig
Interview Questions
Git checks configuration scopes in order of specificity: local first, then global, then system. The first match wins — meaning a local setting overrides a global setting, which overrides a system setting. If the key exists in none of the config files, Git falls back to its compiled-in default. You can see exactly which scope provides each value using git config --list --show-origin.
Without --rebase, git pull performs a merge, creating a merge commit that combines your local changes with the remote changes. This preserves the true branching history but creates a cluttered log. With --rebase, Git replays your local commits on top of the fetched remote changes, creating a linear history that is easier to read. Setting pull.rebase = true makes rebase the default behavior.
Use Git's conditional includes feature (available since Git 2.13). In your global ~/.gitconfig, add [includeIf "gitdir:~/work/"] pointing to a work-specific config file, and [includeIf "gitdir:~/personal/"] pointing to a personal config. Each file contains its own [user] section with the appropriate name and email. Git automatically selects the right identity based on the repository's directory path.
rerere (Reuse Recorded Resolution) remembers how you resolved merge conflicts and automatically applies the same resolution when the same conflict occurs again. This is useful during long-running feature branches that require frequent rebasing onto main — if you resolve a conflict once, rerere handles it automatically on subsequent rebases. Enable it with git config --global rerere.enabled true. Recorded resolutions are stored in .git/rr-cache/.
core.autocrlf controls how Git handles line endings between your working tree and the repository. The three settings are: true (Windows) — converts LF to CRLF on checkout and CRLF to LF on commit, suitable for Windows developers; input (Unix) — converts CRLF to LF on commit only, suitable for macOS/Linux developers; false — no conversion, relying entirely on .gitattributes. The modern recommendation is to set this to false and use a .gitattributes file with * text=auto to let Git handle line endings automatically based on the file type.
push.default simple pushes the current branch to the remote branch with the same name, but only if the upstream is already configured. If no upstream exists, the push fails with a warning. push.default current pushes to the remote branch with the same name regardless of upstream configuration, automatically setting up the tracking relationship. The simple safety guarantee is that you cannot accidentally push a branch to the wrong remote or create an unexpected tracking relationship — every push is intentional and explicit.
Git's three configuration scopes differ in visibility and precedence: --system applies to all users and repositories on the machine (stored in /etc/gitconfig or %PROGRAMFILES%\Git\etc\gitconfig), requires administrator privileges to modify; --global applies to all repositories for the current user (stored in ~/.gitconfig), is the most common scope for personal settings; --local applies only to the specific repository (stored in .git/config), overrides both global and system settings. Precedence is local > global > system — the most specific scope wins.
credential.helper store writes passwords and tokens in plaintext to ~/.git-credentials; do not use it for secrets. On macOS, osxkeychain uses the Keychain and is included with macOS Git. Windows users can use Git Credential Manager or wincred; Git Credential Manager is included with Git for Windows. On Linux, libsecret is packaged in many distributions, while cache holds credentials temporarily in memory. Check that a helper is installed before configuring it. See the official Git helper list and Git Credential Manager install guide.
Conditional includes (includeIf) allow you to load additional configuration based on the repository path or remote URL. The syntax is [includeIf "gitdir:~/path/"] followed by path = ~/.gitconfig-specific. Common use cases: work vs personal identity — switch email/name based on whether repo is under ~/work/; organization-specific settings — different signing keys or aliases per employer; per-project overrides — specific merge tools or diff algorithms for certain codebases. Git automatically evaluates the condition when reading config.
commit.gpgSign = true cryptographically signs every commit with your GPG key, proving the commit was made by you and not tampered with. Enable it for: open source projects where commit authenticity matters, corporate environments requiring compliance verification, or any situation where commit provenance is important. Disable it for: rapid prototyping, throwaway branches, or when GPG keys are not set up — the overhead of signing is minimal but the setup friction may not be worth it for private personal projects.
fetch.prune = true automatically removes remote-tracking branches that no longer exist on the remote repository. Without pruning, your local repository accumulates stale references like origin/feature-xyz even after the remote branch was deleted. This keeps your git branch -a output clean and prevents confusion about which branches are actually available. Enable it globally with git config --global fetch.prune true.
To configure VS Code as a global diff and merge tool, set the tool names and commands with explicit --global scope: git config --global diff.tool vscode, git config --global difftool.vscode.cmd 'code --wait --diff "$LOCAL" "$REMOTE"', git config --global merge.tool vscode, and git config --global mergetool.vscode.cmd 'code --wait "$MERGED"'. Then run git difftool or git mergetool. The $LOCAL, $REMOTE, and $MERGED variables identify the file versions and merge output.
git config --list shows all configuration values merged from all scopes, but you cannot tell which scope each value comes from. git config --list --show-origin adds the file path or scope for each value — lines show file:.git/config, file:~/.gitconfig, file:/etc/gitconfig, or cmdline: (compiled defaults) at the start of each entry. This is essential for debugging configuration conflicts or understanding why a setting behaves unexpectedly.
init.defaultBranch main sets the default branch name created by git init to main instead of the legacy master. Many projects and organizations have switched to main as their primary branch name. By setting this globally once, every new repository you create (and every new repository your team creates) uses the modern convention without manual git branch -m master main commands.
git rerere clear removes all recorded conflict resolutions from .git/rr-cache/. You would use this when: the recorded resolutions are no longer valid due to significant changes in the conflicting code; you want a clean slate for a new project; or you are troubleshooting unexpected rerere behavior. Note that rerere does not automatically clear old resolutions — if the code around a conflict changes substantially, the old resolution might be incorrect and should be cleared.
git config --global --edit opens your configured editor with the .gitconfig file in proper INI format. It validates syntax and prevents common mistakes like missing brackets or malformed values. Editing directly with a text editor risks syntax errors that cause Git commands to fail. Always use the git config command for modifications — it provides safety checks that manual editing lacks.
Use git config --local core.sshCommand "ssh -i ~/.ssh/custom_key" to set a key for the current repository only. Alternatively, use ~/.ssh/config to select keys by host. Keep private keys out of Git configuration.
color.ui enables colored output for Git commands when writing to a terminal. Values: auto (default) — colors only when output is to a terminal, not when piped; always — always emit colors even when piping or redirecting; never — disable colors entirely. Branch, diff, status, and log commands respect this setting independently via their own color.<command> settings.
Aliases create shortcuts for commands in the [alias] section: st = status lets you run git st, and lg = log --oneline --graph --all gives a compact history view. Shell aliases start with ! and execute commands through a shell, so review them before sharing a config. See the Git aliases guide for a small starter set and quoting notes.
help.autocorrect (Git 1.9+) offers to run mistyped commands after a brief delay. Set it to a number representing 1/10th seconds to wait: git config --global help.autocorrect 10 waits 1 second. If you type git statsus, Git suggests git status and runs it after the delay if you don't cancel. Set to 0 to disable, or high values for longer delay.
Further Reading
- Git aliases guide
- Signed commits guide
- Git undo and recovery guide
- Git secrets management guide
- Git credential helpers
- Git Credential Manager setup
- Git Config Documentation — Official reference for all configuration options
- Pro Git — Customizing Git — Comprehensive configuration guide
- Git Attributes — File-level configuration via
.gitattributes - Conditional Includes — Path-based configuration switching
- GPG Commit Signing — GitHub guide to signed commits
Conclusion
Use --local for repository-specific choices, --global for your personal defaults, and --system only when a setting should apply to everyone on the machine. Check the effective value and its origin when a config behaves differently than expected.
Category
Related Posts
Git Aliases and Custom Commands: Productivity Through Automation
Build a small set of Git aliases, understand shell alias risks, and decide when a separate git- command script is easier to maintain.
.gitignore Patterns
Comprehensive guide to .gitignore syntax, pattern matching rules, global ignores, negation, and curated patterns for every major tech stack and framework.
Git Log Forensics: Bisect, Audits, and Recovery
Use Git history for regression searches, audits, and recovery. Learn bisect limits, code-change searches, and how reachable commits differ from reflog entries.