.gitattributes ファイルとは?
.gitattributes ファイルの解説。何をするものか、そして CI/CD でなぜ重要かを含みます。
.gitattributes ファイルは、特定のパスをどう扱うかを Git に指示します: 改行コード、diff/merge の動作、そして LFS のトラッキングです。
何であるか
* text=auto と明示的な eol ルールを設定すると改行コードが正規化され、同じ内容がオペレーティングシステムをまたいで一貫して checkout されます。
CI/CD でなぜ重要か
CI では、これが Linux runner 上での CRLF 関連の失敗 (\r を含む shell script) を防ぎ、どのファイルが Git LFS を使うかを制御します。
重要なポイント
- .gitattributes はパスごとの Git の動作を制御します。
- 改行コードを正規化します。
- CI での CRLF による失敗を防ぎます。
関連ガイド
What Is an .editorconfig file?The .editorconfig file standardizes editor settings across a team. Learn its role.
What Is Git LFS?What is Git LFS? Learn how Large File Storage keeps big binaries out of Git history with pointers, why it spe…
What Is Git?What is Git? A plain-English explainer of the distributed version control system that tracks code history, en…