P
P
pavelpromin2013-11-14 20:42:32
git
pavelpromin, 2013-11-14 20:42:32

Git to backup binary files?

I want to consult on the issue of backup of binary files based on git.
Initial data

  • There are folders by years (for example, 2001, 2002, 2003, etc.)
  • Folder size about 3.5GB each
  • The number of files in each folder is about 14000
  • The files are mostly binary
Required
  • At the end of the year, make a backup (commit) of the folder of the year
  • Make a backup (commit) of changes in folders for other years if they occur
  • Control of changes in a file does not interest. Interested in controlling changes to the file as a whole.
In human language:
I work in the "2013" folder, but sometimes I have to look into the 2012 and 2011 folders, as a result of which changes may occur there too.
The year is coming to an end and I need to backup the 2013 folder as a separate folder. And also back up changes in folders 2012 2011 (for example, as current).
How can this be organized in git? Through the creation of branches?! How to make clean branches with only the current year?!

Answer the question

In order to leave comments, you need to log in

7 answer(s)
A
Andrew, 2013-11-14
@pavelpromin

Step by step.

1. Make a clean repository

2. Make branches for old years (git checkout -b 2011)

3. Save old years there (git add -A && git commit)

4. Return to the master branch (it remains empty)

5. Make the next branch (git checkout -b 2012)

6. Repeat point 3

Also, in order to avoid, you can immediately make an empty branch so that a random merge in master does not force you to do rollbacks later.

That is, for the new year you make a new clean branch, while you can work with impunity in previous years.

I
int03e, 2013-11-14
@int03e

A very strange decision to use git for this. First, it saves each version of a file in history, so be prepared to have your .git folder grow when you commit. Secondly, as far as I remember, it does not store meta-information associated with files. Look at other solutions that are designed specifically for backup.

A
Alexey Kiselev, 2013-11-14
@alexeykiselev

You need to create a separate repository for each year. That is, the new year begins, you create the 2014 repository and work in it.

mkdir 2014
cd 2014
git init
…
git add .
git commit

At the same time, nothing prevents you from working in repositories for previous years and making commits there.

If you need to make a copy on another machine. Then we clone your repositories on it. Or just transfer them by simple copying.

But to be honest, you came up with a very strange use of Git. The problem is not even that you are working with binary files, but that you want to commit once a year. This is very very very rare.

S
Santiago26, 2013-11-17
@Santiago26

Look at the tags. You can keep the files however you like, but each year, tag revisions with the year number. So in the 2012 folder, all files will be with the 2012 tag and you can find them by the tag. If in 2013 you modified a file from the 2012 folder, then this file will have a version tagged 2012 and tagged 2013. And so on.
It might be worth combining this with kaasius's solution. It's also true that using git for binaries is an inappropriate use.

S
Salt_Of_The_Flame, 2013-11-15
@Salt_Of_The_Flame

in general, putting binaries into the version control system, IMHO, is a very bad idea. Might be worth playing around with the git submodule. essence: to cling a link to the revision

Z
zunkree, 2013-11-15
@zunkree

See http://zbackup.org/.

A
Alexander, 2013-11-18
@DrunkenMaster

As already mentioned, git is not the best solution for backup or managing binary files.
But there are projects that you might be interested in: git-fat , git-annex , git-media .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question