3 locations for settings files
- System settings in
/etc/gitconfig
- User settings in
~/.gitconfig
- Project settings in
project/.git/config
Determine what you already have set with
git config --global --list
Recommended basic settings
git config --global user.name "First Last"
git config --global user.email "[email protected]"
git config --global core.editor vim
git config --global help.autocorrect 1
git config --global color.ui auto
# Mac / Linux
git config --global core.autocrlf input
# Windows
git config --global core.autocrlf true
git config --global format.pretty oneline
Check status and such
git status
git add file.txt
git commit
git log
<modify file.txt>
git add -u
git diff hash..hash
git reset --soft HEAD~1
git reset --hard HEAD~1
git clean -n
git clean -f
git log --oneline
git log --graph
git shortlog
git shortlog -sne
git show HEAD
git remote
git remote -v
git branch
git tag
git remote add origin https://url.com/username/project.git
git fetch origin
git log origin/master
git merge origin/master
git branch --set-upstream master origin/master
git pull # or git pull origin master
git stash
git stash list