简体   繁体   中英

git create master branch from develop

Background: When I joined this company, the company used GitHub as it's source control. All development was done on the "develop" branch and I'm not even sure if a "master" branch formally existed. Shortly after joining, we switched to VSTS (now Azure DevOps) Git. We created a new Repo and changed remotes from GitHub to the new Git Repo and pushed develop. 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.

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 . 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). I suspect that this is because "develop" was not created as a branch from "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?

You might want to look into the different merge strategies of 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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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