Git
Git is a distributed version control system. This page covers common global settings and aliases shared by zsh and PowerShell.
Configuration#
The commands below write to the global config ~/.gitconfig. Use the ones you need.
Set your name and email#
Replace Your Name and youremail@domain.com with your own details:
Set the default branch to main#
Name the default branch main in new repositories:
Disable automatic CRLF conversion#
Turn off line-ending conversion on commit and checkout:
Configure a credential helper#
Choose the credential helper for your system.
WSL#
Use the Git Credential Manager bundled with Git for Windows:
Linux#
Store credentials in a local file:
Enable Git LFS#
Enable Git LFS for the current user:
Optional settings#
Enable as needed:
Rewrite HTTPS URLs to SSH when cloning:
Aliases#
zsh and PowerShell use the same set of aliases with the same meaning.
zsh#
Add this to ~/.zshrc:
PowerShell#
Add this to $PROFILE. PowerShell aliases cannot carry fixed arguments, so use functions instead of Set-Alias:
Both shells chain the same way:
References#
- Guany Git config: the author's
.gitconfig.