简体   繁体   English

git从develop创建master分支

[英]git create master branch from develop

Background: When I joined this company, the company used GitHub as it's source control. 背景:当我加入该公司时,该公司使用GitHub作为其源代码控制。 All development was done on the "develop" branch and I'm not even sure if a "master" branch formally existed. 所有开发都在“ develop”分支上完成,我甚至不确定“ master”分支是否正式存在。 Shortly after joining, we switched to VSTS (now Azure DevOps) Git. 加入后不久,我们切换到了VSTS(现在称为Azure DevOps)Git。 We created a new Repo and changed remotes from GitHub to the new Git Repo and pushed develop. 我们创建了一个新的Repo,并将远程控制从GitHub更改为新的Git Repo,并推动了开发。 This was great, we got all of our history and source code. 太好了,我们得到了所有的历史和源代码。 The new VSTS Git repo has a "master" branch, but is not related to our "develop" branch at all. 新的VSTS Git存储库具有一个“ master”分支,但与我们的“ develop”分支完全无关。

Now: Our Dev manager left and with him left the requirement of single branch development ( relief ). 现在:我们的开发经理离开了,他也离开了对单个分支进行开发的需求( 救济 )。 But now I am stuck. 但是现在我被困住了。 The goal is a strategy like nvie . 目标是像nvie这样的策略。 I have tried PR'ing into "master" but this always results in merge conflicts which can not be resolved by merging master into dev and then PR'ing (as I am use to). 我曾尝试将PR'ing合并为“ master”,但这总是会导致合并冲突,而无法通过将master合并为dev再进行PR'ing(如我所习惯的)来解决。 I suspect that this is because "develop" was not created as a branch from "master". 我怀疑这是因为未将“ develop”创建为“ master”的分支。 How can I retro-actively fix this? 我该如何追溯解决此问题? I'd like to keep all the develop commit history. 我想保留所有开发提交历史记录。

I was thinking about renaming develop -> master and then creating a new master, but will this break all the feature branches which are not yet PR'd? 我当时正在考虑重命名“开发”->“母版”,然后创建一个新的母版,但这会中断所有尚未进行PR的功能分支吗?

You might want to look into the different merge strategies of git . 您可能需要研究git的不同合并策略

There is the ours strategy - git merge -S ours develop - that will merge in the develop branch while ignoring all the changes in the develop branch. 还有就是ours战略- git merge -S ours develop -将在开发分支合并,而忽略了所有的变化develop分支。 So will end up with a branch that looks like before but from now on acts as a true descendant of develop allowing further merges to only introduce new changes committed after the first merge. 因此,最终将得到一个看起来像以前一样的分支,但从现在开始,它便成为develop的真正后代,允许进一步的合并仅引入第一次合并之后提交的新更改。

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

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