Skip to content

Instantly share code, notes, and snippets.

@niclaslindstedt
Created January 28, 2021 09:02
Show Gist options
  • Save niclaslindstedt/dae9e3f91e3f9707006d7f0dd394d3a4 to your computer and use it in GitHub Desktop.
Save niclaslindstedt/dae9e3f91e3f9707006d7f0dd394d3a4 to your computer and use it in GitHub Desktop.
.gitattributes for JavaScript projects
# Auto-detect text files
* text=auto eol=lf
# Whitespace exclusions
*.txt whitespace=-blank-at-eof,-space-before-tab,-tab-in-indent,trailing-space,tabwidth=2
*.md whitespace=-blank-at-eof,-space-before-tab,-tab-in-indent,trailing-space,tabwidth=2
*.js whitespace=-blank-at-eof,-space-before-tab,-tab-in-indent,trailing-space,tabwidth=2
*.ts whitespace=-blank-at-eof,-space-before-tab,-tab-in-indent,trailing-space,tabwidth=2
*.json whitespace=-blank-at-eof,-space-before-tab,-tab-in-indent,trailing-space,tabwidth=2
# Treat these as text files with linefeed endings
*.txt text eol=lf
*.md text eol=lf
*.js text eol=lf
*.ts text eol=lf
*.json text eol=lf
*.sh text eol=lf
# Binary files
*.gif binary
*.jpg binary
*.png binary
# Don't count these files in statistics on GitHub
package-lock.json linguist-vendored
yarn.lock linguist-vendored
# Merge our versions of files when merge conflicts arise
package-lock.json merge=ours
yarn.lock merge=ours
# Don't even try to merge these files
package-lock.json -diff
yarn.lock -diff
# Exclude these files from the git archive export (.zip)
.gitattributes export-ignore
.gitignore export-ignore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment