为特殊文件类型设置'git diff' [英] Setup 'git diff' for special file types
问题描述
我想在我的一个存储库中管理Excel文件。区分它们是一个问题(它们是二进制文件)。然而,有一个很好的工具来区分它们: https://github.com/na-ka- na / ExcelCompare
我想使用 .gitattributes
*。xls diff = excel
* .xlsx diff = excel
并且在 .git / config
中:
[diffexcel]
textconv = excel_cmp.bat
命令 excel_cmp.bat file1.xls file2.xls
工作得很好。然而,我使用上面的设置似乎尝试使用 excel_cmp.bat
将excel文件转换为文本,然后对文本输出进行比较。
如何设置diff工具来区分两个文件 - 而不是先转换为文本,然后再比较文本输出?
编辑:
在上面的设置中,git似乎做的是区分 excel_cmp.bat< file1>
和 excel_cmp.bat< file2>
。但是我想要的是 excel_cmp.bat< file1> < file2的>
。我怎么设置它?
好的,我正在寻找的是我的 .gitconfig
:
[diffexcel]
command = excel_cmp.bat
I want to manage Excel files in one of my repositories. Diffing them is a problem (they are binary files). However, there is a nice tool for diffing them: https://github.com/na-ka-na/ExcelCompare
I wanted to set it up using .gitattributes
*.xls diff=excel
*.xlsx diff=excel
And in the .git/config
:
[diff "excel"]
textconv = excel_cmp.bat
The command excel_cmp.bat file1.xls file2.xls
works very well. However, the setup I use above seems to try to convert the excel files to text using excel_cmp.bat
and then diffs the text output.
How do I setup the diff tool to diff two files - and not to convert to text first and then diff the text output?
EDIT:
In the above setting, what git seems to do is to diff the output of excel_cmp.bat <file1>
and excel_cmp.bat <file2>
. But what I want is excel_cmp.bat <file1> <file2>
. How can I set this up?
Okay, what I was looking for was the following in my .gitconfig
:
[diff "excel"]
command = excel_cmp.bat
这篇关于为特殊文件类型设置'git diff'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!