Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 26, 2025

Modernizes .gitattributes to implement Git LFS for binary assets, proper line ending normalization, and .NET-specific file handling per current best practices.

Changes

Binary File Handling

  • Added Git LFS configuration for images, documents, archives, and media files
  • Excludes .NET build artifacts (*.exe, *.dll) which should not be tracked in source control
  • Prevents repository bloat and improves clone performance

Line Ending Normalization

  • Windows-specific files (.cmd, .bat) use CRLF for compatibility
  • All .NET project files (.sln, .csproj, .props, .targets) use LF for cross-platform consistency
  • All source code and configuration files use LF for cross-platform consistency
  • Shell scripts explicitly set to LF

Template Integration

  • Updated .gitattributes files in both Content/Library and Content/Console template directories
  • Ensures generated projects inherit the same comprehensive configuration
  • Added Git LFS setup instructions to README files in both Content/Library and Content/Console directories

Documentation

  • Developer Setup Instructions: Added comprehensive Git LFS setup documentation to template README files
  • Requirements: Added Git LFS as a development requirement in generated projects
  • Step-by-step Setup: Included git lfs install and git lfs pull commands with explanations

File Type Coverage

  • F# source files (.fs, .fsi, .fsx) with proper diff handling
  • Configuration formats (JSON, YAML, XML) with LF normalization
  • SVG files treated as text (XML-based) rather than binary

Before:

* text=auto
*.fs diff=csharp text=auto eol=lf
*.sln text eol=crlf merge=union

After:

* text=auto
# Comprehensive binary LFS handling (excluding build artifacts)
*.png filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
# Cross-platform line endings
*.cmd text eol=crlf
*.csproj text eol=lf merge=union
*.sh text eol=lf
*.svg text eol=lf

Git LFS Setup

Note: Git LFS must be installed and initialized in repositories before these filter rules take effect. Teams should run:

git lfs install
git lfs pull

The generated project README files now include comprehensive setup instructions for new developers.

Original prompt

This section details on the original issue you should resolve

<issue_title>Consider updating .gitattributes</issue_title>
<issue_description>Is your feature request related to a problem? Please describe.

https://rehansaeed.com/gitattributes-best-practices/
https://gist.github.com/Yousha/497397913525af7da814d1711c1eea8d

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.
</issue_description>

<agent_instructions>Make binary files support github LFS
Make Windows specific files like bat/cmd use crlf
Make everything else use lf
Look into any other dotnet best practices for gitattributes</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Update .gitattributes for better file handling Update .gitattributes with comprehensive best practices for .NET projects Oct 26, 2025
Copilot AI requested a review from TheAngryByrd October 26, 2025 03:22
Copilot finished work on behalf of TheAngryByrd October 26, 2025 03:22
@TheAngryByrd TheAngryByrd requested a review from Copilot October 26, 2025 03:25
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR modernizes the .gitattributes file to implement comprehensive best practices for .NET projects, including Git LFS support for binary files and proper line ending normalization.

Key Changes:

  • Implements Git LFS filtering for binary assets (images, documents, archives, executables, media files)
  • Establishes platform-specific line ending rules: CRLF for Windows-specific files (.cmd, .bat, Visual Studio project files) and LF for cross-platform source code
  • Expands file type coverage with explicit handling for F#, configuration files, and web assets

Comment on lines +58 to +63
*.png filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.jpeg filter=lfs diff=lfs merge=lfs -text
*.gif filter=lfs diff=lfs merge=lfs -text
*.bmp filter=lfs diff=lfs merge=lfs -text
*.ico filter=lfs diff=lfs merge=lfs -text
Copy link

Copilot AI Oct 26, 2025

Choose a reason for hiding this comment

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

Git LFS must be installed and initialized in the repository before these filter rules take effect. Consider adding installation/setup instructions to the README or documenting this requirement in the PR description to prevent confusion when team members encounter LFS pointer files instead of actual binary content.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added note to PR description about Git LFS installation requirement. Teams will need to run git lfs install and git lfs track commands before these filter rules take effect in new repositories.

Copy link
Owner

Choose a reason for hiding this comment

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

@copilot you need to update the README's under Content/Library and Content/Console. Don't rely on the PR for documenting this.

Copy link
Owner

@TheAngryByrd TheAngryByrd left a comment

Choose a reason for hiding this comment

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

@copilot Also update the .gitattributes under Content

…from LFS, update Content gitattributes

Co-authored-by: TheAngryByrd <[email protected]>
Copy link
Contributor Author

Copilot AI commented Oct 26, 2025

@copilot Also update the .gitattributes under Content

Updated .gitattributes files in both Content/Library and Content/Console directories with the comprehensive configuration in commit 628586e.

Copilot finished work on behalf of TheAngryByrd October 26, 2025 03:38
Copilot finished work on behalf of TheAngryByrd October 26, 2025 03:39
@TheAngryByrd TheAngryByrd marked this pull request as ready for review October 26, 2025 03:40
@TheAngryByrd TheAngryByrd enabled auto-merge (squash) October 26, 2025 03:41
@TheAngryByrd TheAngryByrd disabled auto-merge October 27, 2025 13:52
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.

Consider updating .gitattributes

2 participants