Skip to content

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

Merged
lmgeorge merged 4 commits intomainfrom
lmg/gitattributes
Jun 7, 2024
Merged

Add a gitattributes file to ensure line-ending consistency and appropriate diff generation#10518
lmgeorge merged 4 commits intomainfrom
lmg/gitattributes

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

lmgeorge added 4 commits May 10, 2024 20:08
**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 force-pushed the lmg/gitattributes branch from cc8f65b to 285e109 Compare May 11, 2024 00:19
@lmgeorge lmgeorge merged commit 2905807 into main Jun 7, 2024
@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