1

My file layout is like so

~/foo/
foo.pl
Foo.pm
    ~/foo/data
        ~/foo/data/an_article.txt
        ~/foo/data/an_article/
            ~/foo/data/an_article/image.jpg
            ~/foo/data/an_article/movie.mp4
        ~/foo/data/another_article.txt
        ~/foo/data/another_article/
            ~/foo/data/another_article/audio.mp3
            ~/foo/data/another_article/raster.nc

Of course, I want git to track the changes to all the text files (the programs, CSS, html templates, and the articles with extension .txt). With regards to the binary files, I want git to track only their latest version. So, if I change movie.mp4, git should include the latest version in its push and pull, but git should not save the previous version. In other words, I want git to do its thing on everything except the binary files, but for binary files git should pretend like it is rsync.

Logic

As is evident from the layout above, ~/foo/data is really my data store. Every article has its own, identically named folder with any relevant binary files. This ensures all related files are in close proximity. If I move the binary files outside this structure then not only do I have to concoct a separate deployment script (perhaps an rsync that synchronizes the binary files), more importantly, I destroy the logical structure of my data store.

Suggestions?

2
  • 2
    > Suggestions? Store your binary files outside of git. While technically doable, the behavior you want would contradict the nature of git. Commented Jul 4, 2013 at 14:30
  • yes, what I am trying to achieve would go against the grain of git. However, I have added more info to the question above under the section titled Logic to explain why I want this, which might help figure an efficient and effective solution. Commented Jul 4, 2013 at 14:38

3 Answers 3

8

Git doesn't work the way you want. A new commit depends on older commits: when calculating the SHA-1 of the new commit, the SHA-1 of the parent commits is included in the calculation. This is exactly what makes Git secure: any modifications to older commits can be detected and would destroy the history.

Sign up to request clarification or add additional context in comments.

Comments

1

As is evident from the layout above, ~/foo/data is really my data store.

for a data store based on git, see git annex: http://git-annex.branchable.com/

for erasing history from git: no such thing, see Bruno Reis' explanation above.

1 Comment

didn't know about git-annex. Thanks. Reading through its docs, I saw a mention of git-media and reading up on that, it seems I probably need git-media more than git-annex
1

Pull in the binary files as part of a deploy script.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.