简体   繁体   English

Git Branch的开发和掌握有所不同

[英]Git Branch develop and master have diverged

I am following a git flow model with my branches, and thus have a develop and master branch, which originally were in sync. 我的分支遵循git flow模型,因此有一个develop和master分支,它们最初是同步的。

My process is create a feature branch from develop, merge it into develop when done with the feature, create a release branch, apply any fixes and when tested fully, merge the release branch back first into the develop branch and then into master. 我的过程是从开发创建功能分支,完成功能后将其合并到开发中,创建发布分支,应用所有修复程序,并在经过全面测试后,将发布分支首先合并回develop分支,然后合并到master。

So they should have been in sync, but apparently have diverged, because every time I merge the release branch into master I am getting merge errors where its asking me to resolve them manually. 因此,它们应该保持同步,但显然存在分歧,因为每次我将发布分支合并到master时,我都会遇到合并错误,它要求我手动解决它们。

My question is, is it a good idea to overwrite the master branch completely with the develop branch and thus start fresh, which I can afford to do at this point in time, or is there another solution to this type of problem ? 我的问题是,用develop分支完全覆盖master分支,然后重新开始,这是一个好主意,我现在可以负担得起,还是对这种类型的问题有其他解决方案?

If you're not able to cleanly merge develop into master then there has to be something in master that's not in develop . 如果您无法将develop干净地合并到master那么master中一定会有一些不在develop You certainly could just declare bankruptcy and push --force develop to replace master , but I would personally be wary of losing something important that just never found its way into master . 您当然可以宣布破产并push --force develop以取代master ,但我个人会警惕丢失一些重要的东西,而这些东西从来没有进入master

After a successful merge of develop into master , does git diff master develop show anything interesting? 一个成功的合并后developmaster ,也git diff master develop说明了什么有趣的?

It seems since you don't mind blowing away your changes in master that are not in develop, you should just overwrite master with develop; 似乎因为您不介意放弃对不在开发环境中的master所做的更改,所以您应该只使用developer覆盖master; going forward, according to your flow you should never be making commits to master, only branch off of develop, then merge into develop, and once in a while merge develop into master when you are sure your build is clean 展望未来,根据您的流程,您永远不应该提交对master的提交,仅从develop分支出来,然后合并为develop,然后在确定您的构建是干净的时不时将develop合并为master

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM