Intro
Reference
- Git SCM: Manual Pages — Reference for all commands.
- Git SCM: Book — The entire “Pro Git” book by Scott Chacon and Ben Straub.
Configure user
Check your current user config:
git config --list
Update your user config:
git config --global user.name "Thomas A. Anderson"
git config --global user.email "[email protected]"
Create .gitignore
Add .gitignore
file to the repository’s root.
# -----------------------------------------------
# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
# -----------------------------------------------
# Node
node_modules
Create .gitattributes
Add .gitattributes
file to the repository’s root.
This will force future commits to use LF endings:
# Force text files to have "LF" endings (not "CRLF").
# See: https://www.aleksandrhovhannisyan.com/blog/crlf-vs-lf-normalizing-line-endings-in-git/
* text=auto
Cleanup files committed with CRLF endings
Run this in terminal to cleanup files already added with CRLF endings:
git add --renormalize .