Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

binary

mo

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.

So can I configure git to do this or is it always going to be a manual exercise?

like image 585
Leo Avatar asked Jan 20 '26 18:01

Leo


1 Answers

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
like image 158
VonC Avatar answered Jan 23 '26 21:01

VonC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!