问题
Say I want to use Git to back up my PC.
I don't care about a full system backup. I don't mind having to reinstall things if my hard drive crashes. I just want to back up my data files, which are all on one partition.
To back up with Git, I could create a repo on that partiion, clone it (bare) on a separate drive or system, and periodically commit and push to back up my files.
What, if any, are the drawbacks to using Git for backup in this way?
回答1:
Git repository takes as much space as every version of your files, compressed. If you're planning to archive precompressed data like photos, be prepared for enormous .git
growth.
As of 2011 Git does not use binary diffs like, for example, Subversion, and stores binary files as they are, compressed.
If you're short of disk space consider using other, more efficient in terms of disk space usage, specialized backup solutions. Borg, attic, restic, duplicity, zbackup come to mind.
回答2:
It's a pretty decent solution, and much better than nothing. Dead simple too, if you're familiar with git.
One downside is that history will be kept forever; there's no easy way to roll off older, stale versions of files, or even to thin older versions. For example, you might like to discard everything older than 3 years, and anything older than a year you only want monthly snapshots. So your backup will continuously grow until it consumes your entire disk.
来源:https://stackoverflow.com/questions/7004904/git-for-important-file-backup-why-not