美文网首页
git迁移(全量分支、tag 和 仅主干两种)

git迁移(全量分支、tag 和 仅主干两种)

作者: 陆小飞 | 来源:发表于2019-07-17 15:56 被阅读0次

全量分支tag一起迁移,包括提交记录

1.先克隆老项目的镜像
git clone --mirror old.git (old.git 为老项目的git地址)

2.进入老项目的目录
cd old.git

3.移除老项目的地址替换成新项目
git remote set-url --push origin new.git (new.git 为新项目的git地址)

4.将镜像推到远程
git push --mirror //这一步需要输入新的git的账号和密码

仅主干

  1. git remote remove origin

  2. git remote add origin git@gitlab.alibaba-inc.com:ele-star-php/ordersoa.git

  3. git branch --set-upstream-to=origin/master master

  4. git push

相关文章

网友评论

      本文标题:git迁移(全量分支、tag 和 仅主干两种)

      本文链接:https://www.haomeiwen.com/subject/iwtclctx.html