Main Branch Reassignment

Hey folks, first time, long time here…

I have three branches for a Project in SonarQube. I would like to change the MAIN BRANCH from Branch “A” to Branch “B” and subsequently delete Branch “A”. I have had little luck finding any documentation on how to go about it.

I have attempted to make the change within the Team City build process with no luck. Can I simply discontinue Branch “A” build in TC and delete Branch “A” within SQ without losing the other two branches?

Thanks!

Hi,

Welcome to the community!

Yes. This should work flawlessly.

 
HTH,
Ann

Thanks for the reply, Ann!

Unfortunately, SQ isn’t letting me delete the MAIN BRANCH from the Branches and Pull Requests UI. I can only rename it. Is there a better way to do this?

Hi,

Uhm… no. You can’t delete main. With the current architecture, it is the project. What you can do is simply start analyzing “Branch B” as main. And… I guess delete “Branch B”.

 
HTH,
Ann

So here’s the fun part. Master2 is actually a dead branch. The project itself is monolith containing 1.2M lines of code, so I would like to clear some land here. Release_B and Main are actually duplicate branches. Ultimately, I would like to delete both Release_B (easy) AND master2, leaving only Main as the Master Branch (seemingly, not as easy)

Simple right? :slight_smile:

Hi,

I’ve just realized that if you do what I advised - analyze the branch you want to keep as main then you’ll essentially lose your branch history. So… since you want to wipe out 2 of the 3 branches & there’s no good way to keep your history, your easiest option may be to just start over. Unless you have a lot of FP/WF issues that you need to retain?

 
Ann