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’ll 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

Merged
merged 4 commits into from
Jun 7, 2024

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
@lmgeorge lmgeorge merged commit 2905807 into main Jun 7, 2024
2 checks passed
@lmgeorge lmgeorge deleted the lmg/gitattributes branch June 7, 2024 16:25
brandemix pushed a commit to brandemix/18F-identity-idp that referenced this pull request Jun 17, 2024
…riate diff generation (18F#10518)

* Add .gitattributes file for diff control

**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.

2 participants