Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Right way of tracking a sqlite3 binary file in git?

I maintain a fork of a repo.

That repo which has been tracking a binary file (which is a sqlite3 file).

Every time I pull from that repo, I experience merge conflict due to that binary file.
What is the right way to solve this kind of merge conflict?

What is the right way to manage binary files (like this sqlite3 *.db file) in git?

like image 654
Abhijeet Rastogi Avatar asked Mar 25 '11 16:03

Abhijeet Rastogi


2 Answers

You could define a custom merge driver specifying to always "keep theirs" (copy the version you are pulling) on top of your current version.

.gitattributes

mysqlite3.db merge=keepTheir

(That being said, remember binaries aren't always best managed with Git, especially if they are modified often)

like image 99
VonC Avatar answered Oct 11 '22 04:10

VonC


I've released a tool that does what you're asking for. It uses a custom diff driver leveraging the sqlite projects tool 'sqldiff', UUIDs as primary keys, and leaves off the sqlite rowid. It is still in alpha so feedback is appreciated.

https://github.com/cannadayr/git-sqlite

like image 39
cannadayr Avatar answered Oct 11 '22 06:10

cannadayr