Setting git up!
Posted on August 20, 2024 • 2 minutes • 230 words
Table of contents
To Config git
take the steps bellow and your basic git setup is done in minutes
There are 3 levels of configurations
Commands to edit each Settings level:
git config --sytem <setting to edit> <setting value>
git config --global <setting to edit> <setting value>
git config --local <setting to edit> <setting value>
Scope
SYSTEM : All Users of current computer
GLOBAL: All repositories of current user
LOCAL: The current Repository
The Settings
Line Endings
Configure Git to ensure line endings in files you checkout are correct for Windows.
For compatibility, line endings are converted to Unix style when you commit files.
For Windows = true
git config --global core.autocrlf true
- For Mac or Linux = input
git config --global core.autocrlf input
The User Name
- Double quotes are present because we have space in our name!
git congif --global user.name "<user's name>"
The Email address
git config --global user.email name@domain.com
The Default Editor (Editor must be added to path)
- –wait makes the terminal wait for the edit to finish
git config --global core.editor "code --wait"
To open settings in the editor
git config --global -e
My Prettified git log
git config --global alias.glog "log --pretty=format:'%C(yellow)%h %C(blue)%ad %C(cyan)| %Creset%s%C(red)%d%Creset [%C(green)%an%Creset]' --graph --date=short"
To list all settings and their origin
git config --list --show-origin
To Disable pager for a specific command
git config --global pager.log false
# or pager.diff for diff, and ...