如何处理二进制文件,例如gitting文件的.mo [英] how to handle gitting of binaries, e.g. .mo files
问题描述
有没有一种简单的方法来处理git的操作二进制文件?我想,我的理想在这种情况下 - 的的.mo文件(二进制的.po消息)'合并' - 是给precedence到较新的文件,复制过来的旧模块顶部
Is there a simple way to handle binary files in git operations? I think my ideal in this case - 'merging' of .mo files (binary .po messages) - would be to give precedence to the newer file, copying it over the top of the older one.
所以我可以配置的git这样做,或者它始终将是一个手动运动?
So can I configure git to do this or is it always going to be a manual exercise?
推荐答案
您可以添加一个自定义中的 gitattributes相对=nofollow> gitattributes文件(见本<一个href=\"http://stackoverflow.com/questions/1910444/git-merge-s-theirs-needed-but-i-know-it-doesnt-exist/1910479#1910479\">SO问题),只为 *。MO
文件,只在相关的目录。
You could add a custom merge driver in a gitattributes file (see this SO question), only for the *.mo
files and only in the relevant directories.
echo *.mo merge=keepTheir > dirWithMoFiles\.gitattributes
git config merge.keepTheir.name "always keep theirduring merge"
git config merge.keepTheir.driver "keepTheir.sh %O %A %B"
使用 keepTheir.sh
为:
mv -f $3 $2
exit 0
这篇关于如何处理二进制文件,例如gitting文件的.mo的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!