Answer the question
In order to leave comments, you need to log in
Git to backup binary files?
I want to consult on the issue of backup of binary files based on git.
Initial data
Answer the question
In order to leave comments, you need to log in
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.
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.
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.
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.
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
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question