How can I process a file, not binary (git)

I have a.uni file and I have to combine the solution. But git treats a.uni as a binary. When I combine the solution, it always shows:

warning: it is not possible to combine binary files: a.uni (HEAD vs. 549af46 ... test) Error: failed to apply 549af46 ... test hint: after resolving conflicts mark corrected hint paths: with 'git add' or 'git rm' hint: and commit the result with git commit 'Can someone else help me !!! Thank you very much.

+4
source share
2 answers

Since your .uni file is actually a text file, I suppose it should have some NUL character in it (see " How to determine if a Git file treats a file as binary or as text? ").

It depends on how you want to manage the merge.

As mentioned in " Tell Git not to merge binary files, but select ", you can specify the merge manager in the .gitattributes file, which will merge according to your policy.

At least, as in the section, why does Git treat some cpp files as binary? , you can try and specify (still use the .gitattributes file):

 *.uni -text crlf diff 

For Unicode files, looking at " Can I make Git recognize a UTF-16 file as text? ", You can:

  • either define a custom comparison or merge tool that supports this format: git config --global diff.tool vimdiff ; git difftool commit1 commit2 git config --global diff.tool vimdiff ; git difftool commit1 commit2
  • or define an attribute like: * .uni diff merge -crlf

You must also make sure:

+4
source

Is the .uni file encoding type changed (for example, UTF-8 - ANSI)? Git does not seem to be able to compare / merge files of different encoding types. See the answer I gave in this post .

0
source

Source: https://habr.com/ru/post/1447392/


All Articles