Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Efficient storage of binary files in a git repository

I would like to have a git repository that consists mainly of binary files.

I need to keep track of the changed, added and removed files to the repository, but I don't want for git to version the content of the files themselves.

In other words, I just need for git to keep track of changes (change log), but not the content.

Is this even possible with git?

Should I be using something else for this?

like image 273
Dema Avatar asked Apr 28 '09 19:04

Dema


People also ask

Should you store binary files in git?

You should use Git LFS if you have large files or binary files to store in Git repositories. That's because Git is decentralized. So, every developer has the full change history on their computer.

Are binary files more efficient?

One of the advantages of binary files is that they are more efficient. In terms of memory, storing values using numeric formats such as IEEE 754, rather than as text characters, tends to use less memory. In addition, binary formats also offer advantages in terms of speed of access.

How binary files are stored?

A binary file is one that does not contain text. It is used to store data in the form of bytes, which are typically interpreted as something other than textual characters. These files usually contain instructions in their headers to determine how to read the data stored in them.

Should I commit binary files?

It's important to never commit binary files because once you've commit them they are in the repository history and are very annoying to remove. You can delete the files from the current version of the project - but they'll remain in the repository history, meaning that the overall repository size will still be large.


3 Answers

Mined from @Tobu's answer to this related question:

To version and propagate binary files without actually storing them in git, try git-annex.

like image 124
toolbear Avatar answered Oct 30 '22 22:10

toolbear


If you don't want to store the bins, than you could use a binary diff tool on the files, then commit the output into version control. Any text change log entries can then be entered in to the commit message.

like image 28
Dana the Sane Avatar answered Oct 30 '22 22:10

Dana the Sane


git is a content tracker, so if you don't want to track content it sounds like it's the wrong tool for the job. I'm not sure exactly how you would track changes to files without tracking their content, though.

like image 32
CB Bailey Avatar answered Oct 30 '22 23:10

CB Bailey