🌱 BasicsCommonly used

How to configure Git

Set up your name, email, editor and other Git preferences.

Set your name
git config --global user.name "Your Name"

Sets the name that appears on your commits globally.

When to use: First thing to set after installing Git.

Set your email
git config --global user.email "you@example.com"

Sets the email that appears on your commits globally.

Set default editor
git config --global core.editor "code --wait"

Sets VS Code as the default editor for commit messages and interactive rebases.

For vim: use vim. For nano: use nano.

Set default branch name
git config --global init.defaultBranch main

Makes "main" the default branch name for all new repositories.

View all config settings
git config --list

Shows all current Git configuration values.

Set up pull with rebase by default
git config --global pull.rebase true

Makes git pull rebase by default instead of creating merge commits.

When to use: For a cleaner linear history.

← Back to Git Reference