We should configure git to standardize the use of line endings so that both windows users and unix-system users create liens with LF line endings.
Detailed Description
Windows systems by default use CLLF line endings while mac + unix machines us just LF line endings. We should standardize the git config to ensure that all files are using LF and that windows systems do not change these to CRLF.
To do so:
Set the Git configuration for the repository:
In the terminal or Git Bash, navigate to the repository directory and set the following Git config:
Set the Git configuration for the repository:
git config core.autocrlf false
core.autocrlf=false: This tells Git not to automatically convert line endings. It will leave line endings as they are in the files.
Ensure all files in the repository use LF line endings:
To ensure all files are using LF line endings, you can refresh the working directory with correct line endings:
git rm --cached -r .
git reset --hard
This removes the cached version of all files, then checks them back out from the index with Unix-style LF line endings.
Add a .gitattributes file
Create a .gitattributes file in the root of your repository with the following content to explicitly enforce LF line endings for all files:
* text eol=lf
This will ensure all text files in the repository will be checked out with LF line endings, regardless of the operating system.
Summary:
Setting core.autocrlf to false ensures that no automatic conversion between CRLF and LF happens.
The .gitattributes file helps to ensure consistency for line endings across all platforms.
Improvement Summary
We should configure git to standardize the use of line endings so that both windows users and unix-system users create liens with LF line endings.
Detailed Description
Windows systems by default use CLLF line endings while mac + unix machines us just LF line endings. We should standardize the git config to ensure that all files are using LF and that windows systems do not change these to CRLF. To do so:
Set the Git configuration for the repository:
core.autocrlf=false
: This tells Git not to automatically convert line endings. It will leave line endings as they are in the files.Ensure all files in the repository use LF line endings:
To ensure all files are using LF line endings, you can refresh the working directory with correct line endings:
This removes the cached version of all files, then checks them back out from the index with Unix-style LF line endings.
Add a .gitattributes file
Create a .gitattributes file in the root of your repository with the following content to explicitly enforce LF line endings for all files:
Summary: