See: man git-config
- System-wide configuration -
/etc/gitconfig
- User(global) configuration -
$XDG_CONFIG_HOME/git/config
or~/.gitconfig
- Repository(local) configuration -
.git/config
git config --global user.name "Your Username"
git config --global user.email "your-email@example.com"
git config --global color.ui auto
git config --global core.editor "nvim"
git config --list --show-origin
git config user.name # query username
git config --global init.defaultBranch main
# get nice formated logs
git config --global alias.l "log --graph --pretty=oneline --abbrev-commit --decorate"
# easily undo the last changes you made with a new git undo command
git config --global alias.undo 'reset HEAD~1 --mixed'
# view your last commit
git config --global alias.last 'log -1 HEAD --stat'
# get a list of your git aliases
git config --global alias.list 'config --global -l'