Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Git think my cs file is binary?

Tags:

git

github

binary

I have just one cs file in my repository which Git seems to think is binary. (In git gui, it just says "binary files differ".)

How can I indicate to Git that my cs file is a text file?

like image 755
Benjol Avatar asked Mar 24 '10 07:03

Benjol


People also ask

Why does git think my .SQL file is a binary file?

gitattributes has a new working-tree-encoding attribute. As mentioned in "Set file as non-binary in git": "Why is Git marking my file as binary?" The answer is because it's seeing a NUL (0) byte somewhere within the first 8000 characters of the file.

What is binary file in git?

Git LFS is a Git extension used to manage large files and binary files in a separate Git repository. Most projects today have both code and binary assets. And storing large binary files in Git repositories can be a bottleneck for Git users. That's why some Git users add Git Large File Storage (LFS).

How does git deal with binary files?

Git can usually detect binary files automatically. No, Git will attempt to store delta-based changesets if it's less expensive to (not always the case). Submodules are used if you want to reference other Git repositories within your project.

Can git diff binary files?

Any binary format can be diffed with git, as long as there's a tool which converts the binary format to plain text. One just needs to add the conversion handlers and attributes in the same way.


1 Answers

You could try and set your cs files as text in a .gitattributes file.

*.vmc diff

(as described in the .gitattributes man page)
or try to diff them as text (git diff --text)

But if your .cs files are UTF-8 or UTF-16, this can be problematic, unless you set your diff to use an external tool able to handle those encoding.

like image 190
VonC Avatar answered Sep 22 '22 15:09

VonC