gpt4 book ai didi

git - 完全备份一个 git 仓库?

转载 作者:IT王子 更新时间:2023-10-29 01:22:13 24 4
gpt4 key购买 nike

有没有一种简单的方法来备份整个 git 仓库,包括所有分支和标签?

最佳答案

git bundle

我喜欢这种方法,因为它只会产生一个文件,更容易复制。
参见 ProGit: little bundle of joy .
另见“How can I email someone a git repository?”,其中命令

git bundle create /tmp/foo-all --all

详细:

git bundle will only package references that are shown by git show-ref: this includes heads, tags, and remote heads.
It is very important that the basis used be held by the destination.
It is okay to err on the side of caution, causing the bundle file to contain objects already in the destination, as these are ignored when unpacking at the destination.


要使用该包,您可以克隆它,指定一个不存在的文件夹(在任何 git 存储库之外):

git clone /tmp/foo-all newFolder

关于git - 完全备份一个 git 仓库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5578270/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com