首页服务器Web服务器 详解git仓库迁移的两种解决方案

详解git仓库迁移的两种解决方案

Git仓库迁移而不丢失log的方法 要求能保留原先的commit记录,应该如何迁移呢? 同时,本地已经clone了原仓库,要配置成新的仓库地址,该如何修改呢? 注意:如果使用了代码审核工具Gerri…

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 directorySYNOPSIS  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.
本文来自网络,不代表1号站长-站长学院|资讯交流平台立场。转载请注明出处: https://www.1cn.cc/fwq/web/2049.html
上一篇分享8个基本的Docker容器管理命令
下一篇 ubuntu16.0.4 设置固定ip地址的方法
admin

作者: admin

这里可以再内容模板定义一些文字和说明,也可以调用对应作者的简介!或者做一些网站的描述之类的文字或者HTML!

为您推荐

评论列表()

    联系我们

    联系我们

    0898-88888888

    在线咨询: QQ交谈

    邮箱: email@wangzhan.com

    工作时间:周一至周五,9:00-17:30,节假日休息

    关注微信
    微信扫一扫关注我们

    微信扫一扫关注我们

    关注微博
    返回顶部