How to mark something as binary in git

Sometimes you may want to override git's decision of wheter a file contains text or binary data. For example, you may have to pull in some external library and want git to track it but not diff it inside. For this, git lets you define what to do with specific files or entire directories.

Simply add a `.gitattributes` file in the root of the project, or in the parent directory of the one you want to affect, and use the following syntax:

# For files
file.txt binary
# For entire directories
folder/* binary 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Comments (

)