git 多仓库

git fetch old-origin master:baseline-main

git push origin baseline-main:baseline-main

git checkout -b baseline-main old-origin/master 以远程分支创建并切换

git push origin baseline-main

git branch baseline-bridge old-origin/relase 以远程分支创建分支

git push origin baseline-main:baseline-main 推上到远程

git branch –set-upstream-to=origin/dev 关联远程分支

git remote rename origin old-origin

Git remote add origin

npm install –save node-sass –registry=https://registry.npm.taobao.org –disturl=https://npm.taobao.org/dist –sass-binary-site=https://npm.taobao.org/mirrors/node-sass/

# 跨仓库合并代码

1. 添加基线仓库

git remote add baseline-origin url

2. 切基线分支到本地

git checkout -b baseline-main baseline-origin/baseline-main

或 git fetch baseline-origin baseline-main

3. 本地开发分支合并基线代码

如果git merge合并的时候出现refusing to merge unrelated histories的错误,原因是两个仓库不同而导致的,需要在后面加上–allow-unrelated-histories进行允许合并,即可解决问题

git merge baseline-main –allow-unrelated-histories

或 git merge baseline-origin/baseline-main –allow-unrelated-histories

# 添加交付仓库 合并代码

1. 添加交付仓库

git remote add jf-origin [交付仓库地址url]

2. 切交付分支到本地

git checkout -b baseline-bridge jf-origin/baseline-bridge // baseline-bridge 是交付中转分支, 交付仓库已存在

git branch –set-upstream-to=jf-origin/baseline-bridge //关联交付远程baseline-bridge分支

3. 在 baseline-bridge 分支上 合并基线分支

git merge [基线分支]

git push // 推送到交付仓库

Leave a Reply

Your email address will not be published. Required fields are marked *