How to tell Subversion to treat a file as a binary file

svn

How do I tell Subversion (svn) to treat a file as a binary file?

Best Answer

It is possible to manually identify a file located within a repository as binary by using:

svn propset svn:mime-type application/octet-stream <filename>

This is generally not necessary, as Subversion will attempt to determine whether a file is binary when the file is first added. If Subversion is incorrectly tagging a certain type as "text" when it should be treated as binary, it is possible to configure Subversion's auto-props feature to automatically tag that file with a non-text MIME type. Regardless of the properties configured on the file, Subversion still stores the file in a binary format within the repository.

If Subversion identifies the MIME type as a "text" type, it enables certain features which are not available on binary files, such as svn diff and svn blame. It also allows for automatic line ending conversion, which is configurable on a client-by-client basis.

For more information, see How does Subversion handle binary files?