It’s a little incomprehensible what your real situation is. The first question you should ask yourself is whether the file should really be tracked - files with non-attachable files are often derived files, as you suggest in the comments, and therefore do not need to be tracked (and should not).
, ? Git - . Git , , , . , Git . .gitattributes - :
path/to/file merge=binary
, . , , . merge=my_merge_driver gitattributes, gitconfig - :
[merge "my_merge_driver"]
name = descriptive name
driver = my_script %O %A %B
script - (O ), (A) (% B) - , - , % A. . man gitattributes.