问题描述
假设你有一个中央主git仓库的场景,开发人员和CI引擎从中克隆。即非常接近传统的非分布式版本控制系统设置,具有中央集线器和大量节点。现在说服务器被盗或遭雷击或其他任何事情导致中央存储库与其所有集中备份一起丢失。你剩下的只是各种克隆,幸运的是其中一个完全更新了,所以你创建了一个空的git仓库替换服务器,用作未来的中央仓库,并开始处理克隆。
完全更新的克隆知道所有具有git branch -a的remotes / origin分支,但只有一个本地分支。 (这是我担心的 - 丢失分支信息)。
重建一个新的中央git存储库的步骤是什么?所有?
只需创建一个空的存储库,并从完全更新的克隆中执行操作:
git remote add new-origin url:// to / new / origin
git push --tags new-origin refs / remotes / origin / *:refs / heads / *
显然,如果新的原点位于相同的网址作为原始文件,您必须小心不从从原始获取。
Say you have a scenario with a central master git repository, which developers and CI-engines clone from. I.e. very close to a traditional non-distributed version control system setup, with a central hub and a lot of nodes.
Now say that server was stolen or struck by lightning or any other thing that would result that the central repository was gone along with all its centralized backups. All you have left is the various clones, and by good fortune one of these was fully updated, so you create a blank git repository replacement server to be used as the future central repository and go to work on the clone.
The fully updated clone knows of all the "remotes/origin" branches with "git branch -a", but does only have a single local branch. (This is what worries me - losing branch information).
What would the steps be for reestablishing a new central git repository behaving in any way like the old one, branches and all?
Just create an empty repository and, from the fully updated clone, do:
git remote add new-origin url://to/new/origin
git push --tags new-origin refs/remotes/origin/*:refs/heads/*
Obviously, if the new origin is at the same url as the original one, you must be careful to not fetch from origin.
这篇关于Firedrill:从开发者克隆重新创建中央git存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!