Skip to content

Instantly share code, notes, and snippets.

@dhrrgn
Last active December 19, 2015 12:18
Show Gist options
  • Save dhrrgn/5953539 to your computer and use it in GitHub Desktop.
Save dhrrgn/5953539 to your computer and use it in GitHub Desktop.
Stop hoping that other's core.autocrlf is set correctly. Add this .gitattributes to the root of your repo. Add any specific files to ensure Git doesn't try anything funny on you. If you think i missed a common extension, let me know in the comments. See here for more details: http://timclem.wordpress.com/2012/03/01/mind-the-end-of-your-line/
# Ensures all line endings are committed as LF, but will checkout with native line endings
* text=auto
# -- Override Section, just in-case Git tries to be sneaky
# Ensure that these files are recognized as text
*.asp text
*.aspx text
*.asx text
*.c text
*.cfg text
*.coffee text
*.cpp text
*.css text
*.erb text
*.erl text
*.go text
*.groovy text
*.h text
*.hs text
*.html text
*.ini text
*.java text
*.js text
*.json text
*.jsp text
*.less text
*.md text
*.markdown text
*.php text
*.pl text
*.properties text
*.py text
*.rb text
*.rhtml text
*.rjs text
*.sass text
*.scala text
*.scss text
*.svg text
*.textile text
*.txt text
*.yml text
*.xml text
Makefile text
Procfile text
# Ensure that these binarys are, well, binary
*.bmp binary
*.bz2 binary
*.gif binary
*.jar binary
*.jpeg binary
*.jpg binary
*.png binary
*.tar.gz binary
*.zip binary
@dhrrgn
Copy link
Author

dhrrgn commented Jul 9, 2013

Added *.c, *.cpp and *.h for C/C++

@mikemand
Copy link

mikemand commented Jul 9, 2013

Missing Makefile as text.

@dhrrgn
Copy link
Author

dhrrgn commented Jul 9, 2013

Thanks. Also added *.cfg. *.ini, *.json and *.yml

@tommorris
Copy link

.pyc should be binary. Of course, ideally, one probably shouldn't be checking .pyc files into version control... but I'm sure people do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment