[英]Merge bug fixes patches from release branch to master branch
I have one master
branch where i am pushing my latest development.我有一个master
分支,我在那里推动我的最新开发。
Now at some point, I do release and create new branch called release1
from master branch.现在在某个时候,我会从 master 分支发布并创建一个名为release1
新分支。
Now i am doing new development on master
branch现在我正在master
分支上做新的开发
Meantime other team also perform some bug fixes on release1
branch.与此同时,其他团队也在release1
分支上执行了一些错误修复。
Now time come for release2.现在是 release2 的时候了。 Here i need to include bug fixes done on release1 to the updated master branch and then fork release2
branch.在这里,我需要将在 release1 上完成的错误修复包含到更新的 master 分支,然后 fork release2
分支。
New release2
branch should have all bug fixes done on release1 branch + latest development occurs after release1 on master branch.新的release2
分支应该在 release1 分支上完成所有错误修复+最新的开发发生在 master 分支上的 release1 之后。
What are the different possible workflow here.And based on that how to play with git merge
and git rebase
and git cherry-pick
command here?这里有哪些不同的可能工作流程。基于此,如何在此处使用git merge
和git rebase
和git cherry-pick
命令?
Solution which I prefer is as below.我更喜欢的解决方案如下。
master -> release1主 -> 发布 1
master will have its own further development, master会有自己的进一步发展,
suppose some bug in release1
branch then one should create hotfix
branch from release1
branch and after fixing bug in hotfix
branch, just merge it into release1
branch and rebase hotfix
with master
branch to maintain history, once rebased with master
branch merge hotfix
in master
branch so bug fixing will be in both master
and release1
branch假设在release1
分支中release1
一些错误,那么应该从release1
分支创建hotfix
分支,在hotfix
分支中的错误后,只需将其合并到release1
分支中并使用master
分支重新设置hotfix
以维护历史记录,一旦在master
分支中使用master
分支合并hotfix
,那么错误修复将在master
和release1
分支中进行
now suppose it's time to have release2
, you just need to create release2
branch from master
branch because all the bugs are already fixed in master branch as well as all the new developments are in master
branch.现在假设是时候发布release2
,您只需要从master
分支创建release2
分支,因为所有错误都已经在 master 分支中修复,并且所有新开发都在master
分支中。
Master
commit1
commit2 -> release1
commit3
commit4
git checkout release1
git checkout -b hotfix
Hotfix
commit2
bugfix1
Merge hotfix with release1 will become与 release1 合并修补程序将成为
git checkout release1
git merge hotfix
Release1
Commit1
commit2
butfix1
Rebase hotfix with master it will rewrite your history使用 master 重新定位修补程序,它将重写您的历史记录
git checkout hotfix
git rebase master
Hotfix
commit1
commit2
commit3
commit4
bugfix1
after that merge hotfix branch to master branch之后将修补程序分支合并到主分支
git checkout master
git merge hotfix
Master
commit1
commit2
commit3
commit4
bugfix1
git branch -d hotfix
git push -d origin hotfix
don't forgot to delete hotfix
because we are already done with that branch there is no more requirement of that branch once merged.不要忘记删除hotfix
因为我们已经完成了该分支,一旦合并就不再需要该分支。 you can also change names of hotfix branch to the jira ticket id or bug id if logged somewhere.如果在某处登录,您还可以将修补程序分支的名称更改为 jira 票证 ID 或错误 ID。
now creating release2 from master which is already have bug fixed in it.现在从 master 中创建 release2,其中已经修复了错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.