how to handle gitting of binaries, e.g. .mo files

后端 未结 3 1011
轻奢々
轻奢々 2021-01-06 13:31

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

3条回答
  •  梦毁少年i
    2021-01-06 14:02

    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"
    

    With keepTheir.sh as:

    mv -f $3 $2
    exit 0
    

提交回复
热议问题