bashbeginner
Git Config — Essential Global Settings
Configure Git globally with aliases, default branch, editor, credentials, and performance settings.
bashPress ⌘/Ctrl + Shift + C to copy
# --- Identity ---
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
# --- Default branch name ---
git config --global init.defaultBranch main
# --- Editor ---
git config --global core.editor "code --wait"
# --- Diff and merge tool ---
git config --global diff.tool vscode
git config --global difftool.vscode.cmd 'code --wait --diff $LOCAL $REMOTE'
git config --global merge.tool vscode
# --- Useful aliases ---
git config --global alias.st 'status -sb'
git config --global alias.co 'checkout'
git config --global alias.br 'branch'
git config --global alias.ci 'commit'
git config --global alias.lg 'log --graph --oneline --all --decorate'
git config --global alias.last 'log -1 HEAD --stat'
git config --global alias.undo 'reset --soft HEAD~1'
git config --global alias.amend 'commit --amend --no-edit'
git config --global alias.wip '!git add -A && git commit -m "WIP"'
# --- Performance ---
git config --global core.fsmonitor true
git config --global core.untrackedcache true
# --- Auto-correct ---
git config --global help.autocorrect 20 # auto-run after 2s
# --- Rebase on pull ---
git config --global pull.rebase true
# --- View all config ---
git config --global --listSponsored
GitHub Copilot
Use Cases
- Setting up Git on a new machine
- Standardizing config across a team
- Productivity aliases for daily workflows
Tags
Related Snippets
Similar patterns you can reuse in the same workflow.
bashbeginner
Git Aliases for Productivity
Essential git aliases and config settings to speed up daily git workflow and reduce typing.
Best for: Speeding up daily git workflow
#git#aliases
bashintermediate
Git Blame — Ignore Formatting Commits
Configure git blame to skip formatting-only commits using .git-blame-ignore-revs for cleaner history.
Best for: Ignoring bulk formatting commits in blame output
#git#blame
bashintermediate
Git Hooks Pre Commit
Git workflow: git-hooks-pre-commit
Best for: version control
#git#version-control
bashadvanced
Git Hooks Post Commit
Git workflow: git-hooks-post-commit
Best for: version control
#git#version-control