How to Manage Git Line Endings Locally Without Committing .gitattributes
Differences between CRLF and LF line endings can cause conflicts when collaborating across Windows and Linux/macOS systems in Git. While placing a .gitattributes file in a repository is the standard fix, developers may prefer not to commit such configuration files to shared codebases. Git offers two alternatives: a per-repository .git/info/attributes file, which sits inside the untracked .git directory, and a global attributes file configured via git config --global core.attributesFile. Both methods support the same rules, such as defaulting text files to LF while keeping CRLF for Windows batch files like .bat and .cmd. This approach lets individual developers enforce consistent line endings in their own environment without affecting the shared repository history.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in