FitzChill FitzChill - 3 months ago 9
Git Question

Git manage binary files

It's been a long time I haven't used git for version control and I have a small question.

Back in time I remember it was possible to manage the git diff strategy when adding binary files in version control.

What I want is to add several png files to my project and modify the way git works with them. When I do a git status or a git diff, I want git to prompt those files only if they were touched and do not try to diff with respect to older versions. So that I can add them and push them without killing the system.

Do you know if it's still possible ?

Answer

Description

Use .gitattributes to specify how git should treat the files.

Example

Here is a sample from my .gitattributes file

*       text=auto
*.html  text
*.css   text
*.bat   text eol=crlf
*.sh    text eol=lf
*.jpg   binary

Reference

git-gitattributes