Reputation: 195
I need some help, how does git handle a binary file for pushing and pulling? Since I have 2 binary files, and I do not want to overwrite them. I want to get their differences. Is this possible? How can it be?
Upvotes: 2
Views: 4014
Reputation: 72845
The number and size of the binary files don't really matter. You should version control assets that are not generated. For really large files (usually uncompressed videos etc.), you might want to use something else but for managing things like sprite sheets, images, small audio clips, PDF files, git will work fine with some caveats.
Normal textual diffs will not be useful. Git has an attribute system which allows you to, among other things, use custom differs so it might be possible. Github added things like image diffing to their website so that you can see differences between images.
When git packs the objects in its database, they are delta compressed. This means that even if you have two 1GB files, once you pack the repository (as is automatically done when you push), the total repository size will quite possibly be significantly lesser than 2GB.
Apart from these, I don't think there are any issues. You can still track revisions of your binary assets and along with good commit logs, it is probably a useful thing to do.
Upvotes: 2
Reputation: 522684
Git will treat binary files for pushing and pulling the same way that it treats text files. But as this excellent blog points out, you should avoid adding binary files to your repository, for so many reasons. First, doing a diff on a binary file will give you a fairly meaningless result. If the diff be completely clean, then you would know that your local copy and the repo are identical. But if the diff shows changes, you likely would not be able to figure out what the changes represent.
Also, binary files tend to be large, and having too many binary files in your repo can make it hard to clone. On top of this, if you want to remove a binary file from your repo, it can be a bit of work.
Upvotes: 0