2

I've been using Git with GitHub for the past couple of years and it all works great, so well in fact that I was planning on using it for other things, mainly Media based projects.

In a former life I was a sound engineer and I can see massive benefits in using branching strategies in running recording sessions. The engineer can create a new feature branch "feature/Recording_BVs" and straight after the recording they can the add and commit the Protools session (audio recording software platform). This would also go some way to solve the age old issue in the music industry of how to backup, share and collaborate on projects.

I was wondering if anyone else using Git in this way (i.e. not purely as a code based repo). For example photoshop sessions, video sessions and so on. Or on the other hand if anyone can talk me out of working like this, are there any drawbacks?

Mark Kenny
  • 1,598
  • 2
  • 17
  • 30
  • It's not the type of other stuff you are suggesting, but I know some people are using Git to manage their configuration files. –  Feb 27 '14 at 14:06
  • 1
    Possible duplicate of [Version Control for Binaries](http://stackoverflow.com/questions/104453/version-control-for-binaries). – raina77ow Feb 27 '14 at 14:38
  • I don't like putting binary files in a git repository even though it works. What I like to do is store the binary files somewhere else with an arbitrary name, perhaps just a sequence number. And then in the git repository store an *index* file, just a text file saying for each binary file which disk file contains the relevant version of that file. It's probably not really any better but I feel more comfortable not storing the binary files in git... – jcoder Feb 27 '14 at 14:48
  • I can understand that updating a binary file will cause a whole new binary to be added to the repo, but it's a rare thing to do in the recording world (destructive editing). Any edits are done on a region basis (pointer to the binary). I like the comment by @raina77ow, makes a lot of sense – Mark Kenny Feb 27 '14 at 15:01

4 Answers4

2

I would advise against this, for one reason. Versioning media files isn't the same as versioning text files.

When you update a single line on a text file, a git commit will record that a single line changed from Hello world to Goodbye.

When you update a single byte on a binary file, a git commit will keep a record of the entire file. There's no point in performing a diff on two binary files - if you wanted to merge branches, rebase branches, whatever, git wouldn't know how to merge two binary files! There's no safe way to do it.

This means that over time, your git repo will grow in size and become huge. That's the reason why it's also recommended to setup git to ignore assemblies (e.g., .dll, .jar, etc)

dcastro
  • 66,540
  • 21
  • 145
  • 155
  • 1
    No, git will always record a new blob object with the entire new contents of the file. It might become a diff-stored pack later when transferring to other repos. – SzG Feb 27 '14 at 14:23
  • @SzG "git will always record a new blob object" - that's what I said. – dcastro Feb 27 '14 at 14:28
  • 1
    A blob object is always the contents of an entire file. – SzG Feb 27 '14 at 14:29
  • 1
    @SzG and... that is what he said? o.O Don't got your point – fotanus Feb 27 '14 at 14:30
  • No, he said it happens only with binary files. But the same happens with text files too. It's not a disadvantage with binary files. Lack of diff and merge, yes, that's a binary-only disadvantage with git. – SzG Feb 27 '14 at 14:31
  • 2
    @SzG Check [this answer](http://stackoverflow.com/a/8198276/1229023) for details. Hint: git _does_ use deltas for storage. – raina77ow Feb 27 '14 at 14:34
  • @Szg I'm pretty sure the whole premise behind source code control is to save the diff between the old version and the new version of the file instead of the whole file, whenever possible. With text files, that's possible. – dcastro Feb 27 '14 at 14:34
  • Beside's SzG's incorrect comment, I'd like to know why was my answer downvoted. – dcastro Feb 27 '14 at 14:35
  • OK, true, git does use diffs in storage. But I cannot remove my downvote now. What to do? – SzG Feb 27 '14 at 14:38
  • I looked up git storage a bit. Diff-storage actually happens quite rarely, as it has a huge speed penalty. – SzG Feb 27 '14 at 15:02
1

git can do this. But internally git stores file contents as deltas (differences) between them. Multimedia files are compressed, so that a few bytes changed in the "contents" (uncompressed) give a massive change in the compressed file, and git doesn't handle that well. Also, for text it is easy to see how to represent a change meaningfully to the user (the familiar diff(1) format, telling you lines added/deleted), for a sound file, say, it is not clear how to do this. And thus operations that are natural with all sorts of text (merge, patch, undo a patch, diff) are hard to do. Luckily source code changes (given decently indented source code, logically organized lines, and all the rest that got hammered into you in programming classes) map cleanly to line changes. If you take just reflowed text, a change adding a word changes the whole paragraph, and might spill over to the rest of the document.

As a case in point, a while back (before git, in fact) a company here needed to store software designs (written in XML or similar) and tried to apply version control to them. This failed miserably for much the same reasons: Semantic changes ("move this module to there") didn't map cleanly to line oriented changes. Even massive changes in lines (say move one <tag> ... </tag> structure around) might have no semantic meaning. They ended up creating their own difference tools to capture meaningful changes.

vonbrand
  • 11,412
  • 8
  • 32
  • 52
0

I'm using git as a backup solution for Redmine. If the mysql dump changes or there is a new file, they go into a git repo, so I can restore the status of any day in the past. Plus, this script is also able to restore Redmine from the git repo. Thus it' s very easy to migrate Redmine from one machine to a new one.

And my personal config files of course: .bashrc, .vim*, etc.

SzG
  • 12,333
  • 4
  • 28
  • 41
0

You can use git for any document you want to track changes. This includes source code, but also any text file (configuration files of programs, sessions, games).

I know someone who do minecraft video and uses git to save his minecraft party (git add . && git commit -m "some interesting point") instead of the "cp dir -r dir.old".

Asenar
  • 6,732
  • 3
  • 36
  • 49