Skip to content

normalize line endings to LF, enforce that with gitattributes - #7291

Merged
jameslamb merged 1 commit into
masterfrom
line-endings
May 23, 2026
Merged

jameslamb merged 1 commit into
masterfrom
line-endings

Conversation

@jameslamb

Copy link
Copy Markdown
Member

#7290 looks like a +776, -364 diff because it touches some files that have CRLF line endings (Windows-specific) and the contributor's local editor or git client rewrote all of them to LF line endings.

Following the advice in https://docs.github.com/en/get-started/git-basics/configuring-git-to-handle-line-endings and the example from dmlc/xgboost#8921, this proposes:

  • adding a .gitattributes file to prevent this from happening in the future (regardless of contributor OS)
  • doing a 1-time update of the repo with git add --renormalize .

Benefits of this change

Such unnecessary line-ending-only changes in PRs add noise to git blame and make reviews more difficult. This change should prevent that from happening again.

Notes for Reviewers

I wrote the .gitattributes file myself.

All other changes were made automatically like this:

git add -renormalize .

@jameslamb
jameslamb merged commit 8e7b3d5 into master May 23, 2026
102 of 109 checks passed
@jameslamb
jameslamb deleted the line-endings branch May 23, 2026 23:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants