git remote git submodule 实现 使用其他仓库并且更新推送不同仓库

380 阅读1分钟

(一)新建三方库 subui

(二) remote 拉取老UI仓库代码新UI仓库代码

// 添加远程版本库:
git remote add originName  git@xxxxcloneaddress
    
  
// 显示所有远程仓库:
git remote -v
    
// 拉取远程库
git fetch originName

// 拉取远程库代码到本地
git rebase originName/master


// 推送代码到远端仓库,后续自己手动合并代码
git push origin master:newbranch

使用这种方式将老仓库移动到新仓库的好处是

  • 1.保留历史commit
  • 2.使用新仓库与老仓库隔离,代码隔离,修改不影响其他业务代码

(三) submodule 添加三方库

// 添加新仓库
git submodule add git@xxxxxxxicodeAddress


(四)编译打包

(五)提交代码


子模块


cd  submodule  

git push ........

(五)脚本上线不同仓库代码