GIT流程-结合灰度发布

2019-10-19  本文已影响0人  一颗老鼠屎

合代码

G3 -> develop

$ git checkout develop

$ git fetch origin

$ git merge origin/develop

$ git merge origin/G3

$ git push origin develop

拉取 develop 分支远程代码 更新到本地 develop 分支 拉取 G3 分支远程代码,与本地 develop 分支做合并 将本地 develop 分支更新后的代码,推送到远程 develop 分支 将本地 develop 分支更新后的代码,推送到远程 develop 分支

打标签

G1

$ git checkout G1

$ git fetch origin

$ git merge origin/G1

$ git tag tag_6.7.1_20191016

$ git tag -l "tag_6.7*"

$ git push origin tag_6.7.1_20191016
拉取分支 打 tag 推送 tag 到远程

覆盖代码

develop -> G1

$ git checkout develop

$ git fetch origin

$ git merge origin/develop

$ git push origin G1    --推送不同分支需要指定本地分支名称
error: src refspec G1 does not match any
error: failed to push some refs to 'git@github.com:wow-blacksheep/saas-service-impl.git'

$ git push origin develop:G1

$ git push origin develop:G1
To github.com:wow-blacksheep/saas-service-impl.git
 ! [rejected]        develop -> G1 (fetch first)
error: failed to push some refs to 'git@github.com:wow-blacksheep/saas-service-impl.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

$ git push origin develop:G1 --force
Total 0 (delta 0), reused 0 (delta 0)
To github.com:wow-blacksheep/saas-service-impl.git
 + 452eecb...aa19a52 develop -> G1 (forced update)
拉取 develop 分支远程代码 更新到本地 develop 分支 将本地 develop 分支更新后的代码 推送到远程 G1 分支 强行覆盖 强行覆盖

覆盖时注意

合代码流程

先将其他分支的修复,按照版本从老到新,依次合并:

G1 -> G2 -> G3 -> develop

然后覆盖最老版本,并保持 develop 为最新版本:

develop -> G1

下一次分支合并:

G2 -> G3 -> G1 -> develop

下一次覆盖:

develop -> G2

上一篇 下一篇

猜你喜欢

热点阅读