Re: concerns about git
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Oct 13, 2008, 18:19 UTC
- Message-ID
- <20081013181941.GT4856@spearce.org>
- In-Reply-To
- <19959918.post@talk.nabble.com>
deepwinter <deepwinter@winterroot.net> wrote:
Show 13 quoted lines
> > i've been looking into using git for some version control and it looks > great.. except for 1 thing that really disturbs me. why is the .git > repository stored within the working copy? this is seems like a recipe for > accidental deletion. if you are an individual using version control lets > say for just your own work, there is a lot of security that is gained from > at least having your repository within a different directory, or better on a > different partition. this ensures that accidental deletions or hard drive > crashes are less likely to result in loosing the ENTIRE project! of course, > accidentally deleting your working copy is stupid, but it does happen. git > seems to offer no protection against this kind of mistake for the individual > coder.. or is there some way to have git put the actual repository files in > a different directory? (can't find info on that)
Because every working copy is equal. They all have a copy of the project's metadata in the .git/ directory.
If you want a backup, create one with clone and push to it every so often, e.g.:
# one time setup $ git clone --bare . /some/other/drive/project.git $ git remote add backup /some/other/drive/project.git
# then every once in a while, or from a cron job $ git push --all backup
Of course since Git is distributed you can you use this same approach to make backups to other systems. You can even edit the .git/config to give the [remote "backup"] section more than one url line, so that "git push --all backup" will send updated copies to multiple locations at once.
Who needs a central repository like SVN or CVS when you can have 3 or 4, on just as many disks, in different buildings, and possibly different parts of the world. Yes, I keep my real work that I care about backed up under different providers, with their data centers located in different countries. And of course extra copies locally, in case the 'net is down.
-- Shawn.