Config user identification
git config --global user.name "my-name"
git config --global user.email "my@email.com"
Default branch name
git config --global init.defaultBranch main
Moved block color
git config --global diff.colorMoved zebra
Pull with Rebase
git config --global pull.rebase true
Shorter minimal git status
git config --global status.short true
Generate an SSH key
You can read generating a new SSH key step by step here.
Confirm all settings
git config -l
# or
cat ~/.gitconfig
Configure and use the git alias
If you are using zsh
, update ~/.zshrc
with the content:
alias ga="git add ."
alias gc="git commit -m"
alias gs="git status"
alias gd="git diff"
alias gp="git push"
alias p="git cherry-pick"
alias conf="code ~/.zshrc"
If you are using fish shell
, update ~/.config/fish/config.fish
with the content:
alias g 'git'
alias ga 'git add .'
alias gs 'git status'
alias gc 'git commit -m'
alias gd 'git diff'
alias gp 'git push'
alias p 'git cherry-pick'
alias conf 'code ~/.config/fish/config.fish'
If you are using nushell, update code $nu.config-path
with the content:
alias g = git
alias ga = git add .
alias gc = git commit -m
alias gs = git status
alias gd = git diff
alias gp = git push
alias p = git cherry-pick
alias conf = code $nu.config-path