Skip to content

Instantly share code, notes, and snippets.

@rliberoff
Created May 28, 2024 11:24
Show Gist options
  • Save rliberoff/871ad56b537e03d368f21bb7bbed6d1d to your computer and use it in GitHub Desktop.
Save rliberoff/871ad56b537e03d368f21bb7bbed6d1d to your computer and use it in GitHub Desktop.
My own and recommended `.gitattributes`
##################################################################################
# Set default behavior to automatically normalize line endings (LF normalization)
##################################################################################
* text=auto
##################################################################################
# Git control files
##################################################################################
*.gitattributes text
.gitignore text
# Exclude files from exporting
.gitattributes export-ignore
.gitignore export-ignore
# Enable syntax highlighting for files with `.gitattributes` extensions.
*.gitattributes linguist-language=gitattributes
##################################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just comment the entries below and
# uncomment the group further below
##################################################################################
*.sln text eol=crlf merge=union
*.csproj text eol=crlf merge=union
*.vbproj text eol=crlf merge=union
*.vcxproj text eol=crlf
*.vcproj text eol=crlf
*.dbproj text eol=crlf
*.fsproj text eol=crlf merge=union
*.lsproj text eol=crlf
*.wixproj text eol=crlf
*.modelproj text eol=crlf
*.sqlproj text eol=crlf
*.wmaproj text eol=crlf
*.xproj text eol=crlf
*.props text eol=crlf
*.filters text eol=crlf
*.vcxitems text eol=crlf
# CSharp (C#) Specifics
*.cs text diff=csharp
*.cshtml text diff=html
*.csx text diff=csharp
##################################################################################
# These settings are for PowerShell files.
#
# Details per file setting:
# text These files should be normalized (i.e. convert CRLF to LF).
#
##################################################################################
*.ps1 text eol=crlf
*.ps1x text eol=crlf
*.psm1 text eol=crlf
*.psd1 text eol=crlf
*.ps1xml text eol=crlf
*.pssc text eol=crlf
*.psrc text eol=crlf
*.cdxml text eol=crlf
##################################################################################
# These settings are for any web project.
#
# Details per file setting:
# text These files should be normalized (i.e. convert CRLF to LF).
# binary These files are binary and should be left untouched.
#
# Note that binary is a macro for -text -diff.
##################################################################################
# Source code
*.bash text eol=lf
*.bat text eol=crlf
*.cmd text eol=crlf
*.coffee text
*.css text diff=css
*.htm text diff=html
*.html text diff=html
*.inc text
*.ini text
*.js text
*.json text
*.jsx text
*.less text
*.ls text
*.map text -diff
*.od text
*.onlydata text
*.php text diff=php
*.pl text
*.py text diff=python
*.rb text diff=ruby
*.sass text
*.scm text
*.scss text diff=css
*.sh text eol=lf
*.sql text
*.styl text
*.tag text
*.ts text
*.tsx text
*.xml text
*.xhtml text diff=html
# Docker
Dockerfile text
# Documentation
*.ipynb text
*.markdown text diff=markdown
*.md text diff=markdown
*.mdwn text diff=markdown
*.mdown text diff=markdown
*.mkd text diff=markdown
*.mkdn text diff=markdown
*.mdtxt text
*.mdtext text
*.txt text
AUTHORS text
CHANGELOG text
CHANGES text
CONTRIBUTING text
COPYING text
copyright text
*COPYRIGHT* text
INSTALL text
license text
LICENSE text
NEWS text
readme text
*README* text
TODO text
# Templates
*.dot text
*.ejs text
*.haml text
*.handlebars text
*.hbs text
*.hbt text
*.jade text
*.latte text
*.mustache text
*.njk text
*.phtml text
*.tmpl text
*.tpl text
*.twig text
*.vue text
# Configs
*.cnf text
*.conf text
*.config text
.editorconfig text
.env text
.gitattributes text
.gitconfig text
.htaccess text
*.lock text -diff
package.json text eol=lf
package-lock.json text -diff
pnpm-lock.yaml text eol=lf -diff
.prettierrc text
yarn.lock text -diff
*.toml text
*.yaml text
*.yml text
browserslist text
Makefile text
makefile text
# Heroku
Procfile text
# Graphics
*.ai binary
*.bmp binary
*.eps binary
*.gif binary
*.gifv binary
*.ico binary
*.jng binary
*.jp2 binary
*.jpg binary
*.jpeg binary
*.jpx binary
*.jxr binary
*.pdf binary
*.png binary
*.psb binary
*.psd binary
*.svgz binary
*.tif binary
*.tiff binary
*.wbmp binary
*.webp binary
# SVG treated as an asset (binary) by default.
*.svg text
# If you want to treat SVG as binary use the following line instead.
# *.svg binary
# Audio
*.kar binary
*.m4a binary
*.mid binary
*.midi binary
*.mp3 binary
*.ogg binary
*.ra binary
# Video
*.3gpp binary
*.3gp binary
*.as binary
*.asf binary
*.asx binary
*.fla binary
*.flv binary
*.m4v binary
*.mng binary
*.mov binary
*.mp4 binary
*.mpeg binary
*.mpg binary
*.ogv binary
*.swc binary
*.swf binary
*.webm binary
# Archives
*.7z binary
*.gz binary
*.jar binary
*.rar binary
*.tar binary
*.zip binary
# Fonts
*.ttf binary
*.eot binary
*.otf binary
*.woff binary
*.woff2 binary
# Executables
*.exe binary
*.pyc binary
# RC files (like .babelrc or .eslintrc)
*.*rc text
# Ignore files (like .npmignore or .gitignore)
*.*ignore text
##################################################################################
# These settings are for any Infrastructure as Code (IaC) file.
#
# Details per file setting:
# text These files should be normalized (i.e. convert CRLF to LF).
#
##################################################################################
*.bicep text
## Terraform
*.go text eol=lf
*.hcl text eol=lf
*.tf text eol=lf
*.tfvars text eol=lf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment