Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a gitattributes file to ensure line-ending consistency and appropriate diff generation #10518

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

lmgeorge
Copy link
Contributor

@lmgeorge lmgeorge commented Apr 29, 2024

馃帿 Ticket

Link to the relevant ticket: N/A

馃洜 Summary of changes

Overview

The purpose of a Git Attributes file is to control merge and diff strategies for different files based on a set of markers applied by Git. These Git Attributes files are read per-directory, in a cascading fashion, similar to Git Ignore files.

The most common use case is to ensure some files are treated as binary files (no diff generation) or to control line-ending normalization.

What's changed

  • Added a .gitattributes file
    • This file only includes some basic overrides indicated by the files in the repo and otherwise defaults to Git's system level heuristics
  • Normalized line endings in one file

Copy link
Contributor

@zachmargolis zachmargolis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't run into issues without this, but seems reasonable to try! LGTM

.gitattributes Outdated Show resolved Hide resolved
**Why**:

- The purpose of a Git Attributes file is to control merge and diff strategies
  for different files based on a set of markers applied by Git.
- The most common use case is to ensure some files are treated as binary
  files (no diff generation) or to control line-ending normalization
  across operating systems.

**How**:

- Adding rules is similar to how `.gitignore` files work
- `.gitattributes` files can also be added per directory
- Repository-wide rules should be chosen with care and the knowledge
  that this production environment for this code base is Linux-based.
- See https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes for
  more information.

changelog: Internal, Code Management, Standardize Git-based file handling
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.

None yet

2 participants