Skip to content

Instantly share code, notes, and snippets.

@stephenchew
Created August 14, 2023 06:49
Show Gist options
  • Select an option

  • Save stephenchew/840eb4db0026055be4283b857b4e13af to your computer and use it in GitHub Desktop.

Select an option

Save stephenchew/840eb4db0026055be4283b857b4e13af to your computer and use it in GitHub Desktop.
Force source file to be LF on Windows

Force source file to be LF on Windows

Follow the instructions below to force all files to be checked out as LF, especially in Windows.

  1. Create .gitattributes file in the root directory of the project, if one does not exist.
  2. Add the following line to the file
    * text=auto eol=lf
    
  3. Run the following command to remove all Git caches (mind the trailing ., it indicates current path)
    git rm --cached -r .
    
  4. Checkout everything again
    git reset --hard
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment