我们专注攀枝花网站设计 攀枝花网站制作 攀枝花网站建设
成都网站建设公司服务热线:400-028-6601

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

详解git仓库迁移的两种解决方案-创新互联

Git仓库迁移而不丢失log的方法

专业成都网站建设公司,做排名好的好网站,排在同行前面,为您带来客户和效益!成都创新互联为您提供成都网站建设,五站合一网站设计制作,服务好的网站设计公司,成都做网站、网站制作负责任的成都网站制作公司!

要求能保留原先的commit记录,应该如何迁移呢?

同时,本地已经clone了原仓库,要配置成新的仓库地址,该如何修改呢?

注意:如果使用了代码审核工具Gerrit,那么在进行操作之前需要将Gerrit关掉,等成功恢复后再将Gerrit开户即可

1、使用git push --mirror

先了解一些git的基本参数介绍

git clone --bare

GIT-CLONE(1)      Git Manual      GIT-CLONE(1)

NAME
  git-clone - Clone a repository into a new directory

SYNOPSIS
  git clone [--template=]
     [-l] [-s] [--no-hardlinks] [-q] [-n] [--bare] [--mirror]
     [-o ] [-b ] [-u ] [--reference ]
     [--depth ] [--recursive] [--]  []
  --bare
   Make a bare GIT repository. That is, instead of creating  and placing the administrative files
   in /.git, make the  itself the $GIT_DIR. This obviously implies the -n because there
   is nowhere to check out the working tree. Also the branch heads at the remote are copied directly to
   corresponding local branch heads, without mapping them to refs/remotes/origin/. When this option is used,
   neither remote-tracking branches nor the related configuration variables are created.

git push --mirror
--mirror
   Instead of naming each ref to push, specifies that all refs under refs/ (which includes but is not limited
   to refs/heads/, refs/remotes/, and refs/tags/) be mirrored to the remote repository. Newly created local
   refs will be pushed to the remote end, locally updated refs will be force updated on the remote end, and
   deleted refs will be removed from the remote end. This is the default if the configuration option
   remote..mirror is set.

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


分享文章:详解git仓库迁移的两种解决方案-创新互联
本文URL:http://mswzjz.cn/article/djccdo.html

其他资讯