gitconfig
gitconfig files
Gitconfig files are used to configure git and allow you to tailor how git works to your requirements. For example, automatically handling line endings if you work across Windows, Linux and Mac, or defining your preferred editor for working with code files.
- This page discusses some of the customisations and configurations for .gitconfig files
- See Git Configuration for more details
Auto CRLF
- Carriage Return (CR)
- Line Feed (LF)
When working between Windows (CRLF), Linux/Unix (LF) and some versions of Mac OS (CR) line endings can be an issue and cause scripts and programs not to run as expected where the OS doesn’t correctly parse the code.
Scott Hanselman has a good primer video here: What’s a Carriage and Who’s Feeding it Lines? CRLF - Computer Stuff They Didn’t Teach You #1
- When installing Git For Windows it prompts for an option of “Checkout Windows style, commit Unix style” which automatically sets this property
- Alernatively this can be configured directly in the .gitconfig file or from the command line
│ File: /Users/grwatts/.gitconfig
───────┼───────────────────────────────────────────────────────────────────────────────────────
1 │ [core]
2 │ autocrlf = true
git config --global core.autocrlf=true