push vs bundle vs tar zcvf - 备份整个本地.git [英] push vs. bundle vs. tar zcvf -- to backup entire local .git
问题描述
我可以备份我的本地.git,通过两步将其推送到存储库:
git push --all〜 / gitrepo
git push --tags〜/ gitrepo
我可以使用<一个href =https://stackoverflow.com/questions/2129214/backup-a-local-git-repository> git捆绑。
我可以通过复制整个目录或将其归档(压缩!)来备份它:
tar -zcvf gitrepo.tgz .git
现在的问题是他们是否真的相当? (例如, logs
子目录不被推送)
<$ c $的优点c> git push 方法与 git bundle
?
可以 tar -zcvf
被认为是完美的git备份? $ c> tar :它可以保存所有内容:config(远程URL),reflog等。如果您意外地在存储库中执行某些非常愚蠢的操作,可能需要reflog 和您的硬盘驱动器不久后崩溃。牵强,但 tar
很简单,它可以做任何事情。使用 tar
进行备份,使用 git push
来制作镜像。这些是不同类型的任务。
关于压缩:我有一个27M的git repo,几乎全是纯文本, .tar.gz
...也是27M。这不是一大笔节省。
I can backup my local .git by pushing it to a repository in two steps:
git push --all ~/gitrepo
git push --tags ~/gitrepo
I can back it up using git bundle.
I can back it up by simply copying the entire directory or archiving it (compressed!):
tar -zcvf gitrepo.tgz .git
And there are probably additional ways to backup an entire local .git.
The question now is whether they are really equivalent? (for example, the logs
subdirectory isn't pushed)
What are the advantages of the git push
method vs. git bundle
?
Can tar -zcvf
be considered "the perfect git backup"?
Regarding tar
: It saves everything: the config (remote URLs), the reflogs, etc. You might want the reflogs if you accidentally do something really stupid in your repository and your hard drive crashes shortly afterwards. Far-fetched, but tar
is easy and it does everything. Use tar
for making backups, use git push
for making mirrors. These are different kinds of tasks.
Regarding compression: I have a 27M git repo, almost entirely plain text, and the .tar.gz
is... also 27M. That's not a whole lot of savings.
这篇关于push vs bundle vs tar zcvf - 备份整个本地.git的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!