Skip to content

Latest commit

 

History

History
65 lines (46 loc) · 1.35 KB

README.md

File metadata and controls

65 lines (46 loc) · 1.35 KB

Git Configuration

See: man git-config

  • System-wide configuration - /etc/gitconfig
  • User(global) configuration - $XDG_CONFIG_HOME/git/config or ~/.gitconfig
  • Repository(local) configuration - .git/config

Set up your username/email address

git config --global user.name "Your Username"
git config --global user.email "your-email@example.com"

Enable helpful colorization of git command line output

git config --global color.ui auto

Set your default editor

git config --global core.editor "nvim"

Check your current git configuration

git config --list --show-origin
git config user.name # query username

Set 'main' as default branch name from 'master'

git config --global init.defaultBranch main

Define Git Aliases: using git alias (place in your global .gitconfig file)

# 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'

See Also

commit-conventions