Skip to content

Add a .gitattributes file#62

Closed
majcosta wants to merge 1 commit into1dot13:masterfrom
majcosta:pr_gitattributes_and_renormalization
Closed

Add a .gitattributes file#62
majcosta wants to merge 1 commit into1dot13:masterfrom
majcosta:pr_gitattributes_and_renormalization

Conversation

@majcosta
Copy link
Copy Markdown
Contributor

@majcosta majcosta commented Jan 3, 2023

... and make sure they stay that way.

What this does is:

  • Ensure that every new text file checked into added to the repo uses LF line endings. Currently it's all over the place, including 2 files which had both CRLF and LF in them. People can still choose whichever line endings they prefer when cloning the repo, just tweak core.autocrlf to their taste, e.g. usually true on Windows and input on Linux/macOS

* Added an override so that Visual Studio files always use CRLF, just to be safe, although VS handles LF just fine for those files.

Please don't review this line by line, it's just the .gitattributes file and once it's saved you run 'git add --renormalize .' to make all line endings in the repo consistent.

If you want to do the same to the files in your working tree, run 'git rm --cached -r .' then 'git reset --hard'

Edit: Manually fixed the two files that had both CRLF and LF line endings on them.

reference:
https://www.aleksandrhovhannisyan.com/blog/crlf-vs-lf-normalizing-line-endings-in-git/ and https://rehansaeed.com/gitattributes-best-practices/

@majcosta majcosta force-pushed the pr_gitattributes_and_renormalization branch 2 times, most recently from e853a49 to 07a3196 Compare January 5, 2023 15:48
... and make sure they stay that way.

What this does is:

* Ensure that every file checked into the repo uses LF line endings.
  Currently it's all over the place, including 2 files which had both
CRLF and LF in them. People can still whichever they prefer when cloning
the repo, just tweak core.autocrlf to their taste, e.g. usually 'true' on
Windows and 'input' on Linux/macOS

* Added an override so that Visual Studio files always use CRLF, just
  to be safe, VS certainly handles LF just fine for those files.

Please don't review this line by line, it's just the .gitattributes file
and once it's saved you run 'git add --renormalize .' to make all line
endings in the repo consistent.

If you want to do the same to the files in your working tree, run 'git
rm --cached -r .' then 'git reset --hard'

reference:
https://www.aleksandrhovhannisyan.com/blog/crlf-vs-lf-normalizing-line-endings-in-git/
and https://rehansaeed.com/gitattributes-best-practices/
@majcosta majcosta force-pushed the pr_gitattributes_and_renormalization branch from 07a3196 to 8379f5e Compare January 5, 2023 15:50
@majcosta majcosta changed the title Normalize line endings with a .gitattribute file Add a .gitattribute file Jan 5, 2023
@majcosta majcosta changed the title Add a .gitattribute file Add a .gitattributes file Jan 5, 2023
@majcosta majcosta closed this Jan 14, 2023
@majcosta majcosta deleted the pr_gitattributes_and_renormalization branch January 14, 2023 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant