Re: Cutting history

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jul 10, 2010 at 08:47, Jakub Narebski <jnareb@xxxxxxxxx> wrote:
> Joshua Jensen <jjensen@xxxxxxxxxxxxxxxxx> writes:
>
>>   ----- Original Message -----
>> From: Enrico Weigelt
>> Date: 7/9/2010 9:25 PM
>>
>> > I'm using git for automatic backups (eg. database dumps). This
>> > works quite well, but as time goes, the history (and so the repo)
>> > gets larger and larger. It would be really nice to allow cutting
>> > off old stuff (eg. after N commits in the past).
>
> This is certainly Using Git For What It Was Not Intended...

It actually works very well though. I use Git to back up MySQL
databases like this.

Here's the script I use to dump MySQL databases:

    http://github.com/avar/linode-etc/blob/master/bin/cron/mysqldump-to-git

And a small wrapper to dump them all:

    http://github.com/avar/linode-etc/blob/master/bin/cron/mysqldump-to-git-all

I make dumps every 6 hours:

    http://github.com/avar/linode-etc/blob/master/cron.d/v-mysql-git-backup

And after each dump I repack & prune (some of this is probably
redundant given the linear history) the repository:

    http://github.com/avar/linode-etc/blob/master/bin/cron/git-repack-and-gc-dir

And here's graph showing how big the dumps get:

    http://munin.nix.is/nix.is/v.nix.is/dirs_var_backup_mysql.html

The climbing charts before the size cutoff were before I started
repacking them.

As for pruning old history, I thought this *should* work for pruning
history older than 7 days (given that you dump daily):

    git rebase --strategy=base --onto master~8 master~7

But of course that deletes new commits. I need to freshen up on my
rebase understanding. Maybe someone else on list knows how to do
that. I thought git rebase --interactive might work, but I can't get
it to display the root commit. Maybe you need git-filter-branch.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]