Can Git combine zip archives, MS Office documents, etc.?

Git for Windows.

I am learning git. My project has some file projectname.hmxzinstead of plain text files. This file is a zip archive (with a modified extension). This is a special project file used by Help & Manual . Can I use Git for such projects? This bothers me because each branch will have a modified version of the file projectname.hmxz, which is not a regular text file. How will Git merge such branches with a single file projectname.hmxz? I think the same problem will be with MS Office documents: xls, doc, etc. (Because it is also not a plain text).

I have no problem with regular text files, but what about such cases?

+4
source share
4 answers

Mail files:

No, they are binary. For binary files, merging conflicts is permitted only as "use version A" or "use version B".

But if you build them from some source, perhaps you can control this source using the version.

MS Office Files:

No, It is Immpossible. But they are often treated as text files, so the first time they merge git, they will get corrupted. You must manually configure git to treat them as binary. Follow this instruction: fooobar.com/questions/710291 / ...

+3
source

Git can only merge text files, however ...

textconv , , .

.

+1

, .

, here there. ours recursive (, , recursive - ):

git merge --strategy=recursive -Xours there

- ( there), :

git merge --strategy=recursive -Xtheirs there

, , !

. git-merge(1) manpage. Windows, : https://git-scm.com/docs/git-merge

+1

git , . , / , , . , , npm-merge-driver. , .

Additionally, you can customize merge tools in git. Thus, you can transfer two / three versions of the file to the program of your choice . Again, a quick search did not show how to do this using Word. However, there are many blog entries explaining how to do this in detail, so I only refer to the manual.

0
source

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


All Articles