paulinho
paulinho

Reputation: 302

How to prevent git from automatically doing a binary diff on large files?

I've read online that once the files in a merge exceed a certain threshold, git automatically does a binary diff instead of a textual one. As a result, we lose the functionality of line-by-line resolution, even if the diff itself is quite small.

I have a ~1.3 GB CSV file that is supposed to represent a database, and it seems as if this is just over this large file threshold, according to this link. I'm currently trying to benchmark Git's conflict detection algorithm, so I would need the textual diff algorithm to run on this file.

Is there a way to increase the size threshold for automatically doing a binary diff instead of a textual one? I have already tried

git config --global --add core.bigFileThreshold 2g

but that seems not to help. I think it doesn't help because from what I understand, this only sets an upper bound on the size of file eligible for a textual diff, but having a file size less than core.bigFileThreshold doesn't guarantee it won't treat it as binary.

Upvotes: 1

Views: 492

Answers (1)

jthill
jthill

Reputation: 60255

As your link mentions, Git uses xdiff for text diffing, and

that 1GB limit is a hard limit that the code can't cope with; our options are either to generate a binary diff or to die.

so the answer to

Is there a way to increase the size threshold for automatically doing a binary diff instead of a textual one?

would seem to be "no."

Upvotes: 5

Related Questions