在外部磁盘上备份整个git存储库的最佳方式是什么? [英] What is the best way to back up an entire git repository on external disk?
问题描述
使用常规复制整个工作副本文件系统复制命令正常工作。您还可以压缩/ tar备份。
如果您担心磁盘空间,您还可以查看 git bundle ,它可以生成较小的文件。
你也可以通过在外部磁盘上启动一个新的回购(git clone)来获得增量备份,然后每次取出更改(git pull)。在分布式系统(如git)中,备份和工作副本之间没有太大区别。
So I want to be able to back up a git repository that may have several branches onto an external hard drive and then be at a later time be able to copy it back onto my local machine and work with it as usual? I have tried simply copying the working directory folder containing the .git directory and it worked. However, I was wondering if this was the best way or if it had pitfalls later.
Copying the entire working copy using regular file system copy commands works fine. You can also zip/tar the backup.
If you are worried about disk space, you can also look at "git bundle", which could produce smaller files.
You can also get incremental backups by just starting a new repo on the external disk (git clone) and then pull the changes every time (git pull). There is not much difference between a backup and a working copy in a distributed system like git.
这篇关于在外部磁盘上备份整个git存储库的最佳方式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!