Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

Making a branch the "main"

Hopefully this is a rather basic question... As I've been learning Onshape I've been making "versions" as I hit major changes in my models. I'm treating this like a "save as". I get how it works, you can go back in your history and roll back to any version you want at any time.

I'm now at a point in some of my models where I actually want to "branch" and experiment on a design, and possibly make that a part of my main design (or abandon that branch because my idea was bad!)

In this particular model, apparently I created some branches:



"B3" is what I would consider to be the "current" model that I want to start branching from.

So the question: Is there a way that I can make B3 the main branch, essentially overwriting any previous branches? I tried to merge it back into the main, but the main seemed to "win".

As far as I'm concerned everything that's not "B3" in this model is old and out of date. Can anyone help me deal with this? Thanks!

Comments

  • Roy_MutalikRoy_Mutalik Member, Onshape Employees Posts: 41 image
    edited February 2019
    Hi Eric,

    This is a great question, that can trip up new and seasoned Onshape users alike, so thanks for asking! There are two pieces to answering it.

    First off, the reason you are seeing "Main" branch winning over the "B3" is that Merge is directional; the workspace you merge into will have priority. If you do need to see the sum of the changes between "B3" and "Main", you can try merging the other way (activate "B3", and select "Main" as the workspace to merge into it). 

    Aside from/in addition to that, do remember that the branch names are just names - you can change them however you need. "Main" is no more important or functional than any other branch you create (it's just named that because we have to name the first branch something). You can simply re-name "Main" to something else, and if you see fit then even rename "B3" to "Main". To do this, simply right-click the branch, and view its properties.

    As long as you understand which branch is which, that's all that really matters!
  • brucebartlettbrucebartlett Member, OS Professional, Mentor, User Group Leader Posts: 2,148 PRO
    Another thing to understand is the "main" trunk branches and any versions cannot be deleted but branches can be permanently deleted. 

    For merge I always have to remind myself to go to the workspace I want to merge to then activate the merge by hovering over the branch node.  
    Engineer ı Product Designer ı Onshape Consulting Partner
    Twitter: @onshapetricks  & @babart1977   
  • baumarbaumar OS Professional Posts: 83 PRO
    edited March 2025

    I do not fully understand.

    In versioning tools like git there is rebasing (https://git-scm.com/book/en/v2/Git-Branching-Rebasing) which puts the head of the branch on top of the master. (This will the 'overwrite' rsp yield the changes in master between the time of branching and rebasing).

    That's a great possibility when you made a development that was not good enough and you have a branch with a better solution. you want to avoid the pain to merge the good solution into the bad one, you rather want to get rid of that bad part at all.

    The only way I found so far was creating a new workspace from the branch, but then I loose all history which was not what I wanted.
    If I leave the branch and master in one workspace, the program always opens the master. Once I did not notice and continued on the master and had to copy all to the branch, not nice.

    So in short: How can I get a workspace that has all the history of the branch only and get rid of master (and maybe other branches not needed)
    Is this possible?

    If there is a solution for this, could you maybe add a small video?

  • jason_ryan337jason_ryan337 Member Posts: 71

    Hi all. I know this is old, but I have a similar question. I branched a while back and want to stay with this development leg and will not return to main. Can someone advise the best path with this in mind? Do I keep doing what I'm doing?

    image.png
  • jnewthjnewth Member, OS Professional Posts: 108 PRO

    @jason_ryan337 These days it's pretty simple. There is still a single, canonical "Main" branch, but you can pick your merge strategy to choose B1 over anything from main.

    Steps:

    1. switch back to tip of Main branch
    2. right-click on tip of B1
    3. Select merge in to current workspace (merging B1 in to current workspace which is Main)
    4. On the merge dialog, observe that the Tab merge strategy for each tab says something like "Merge changes from both". That's the problem you are trying to get around.
    5. Select "Replace with B1" (The "Overall merge strategy" row is clickable. Click far-right).
    6. Observe that Tab merge strategy (assuming you have many tabs) now all say "Replace with B1":
    Screenshot 2026-02-14 195952.png Screenshot 2026-02-14 200339.png

    7. Commit. Observe result.

    Also note: Because Onshape is totally great, you can always undo a merge even if you mess it up. Just find the place in the history before you messed up and restore it to main. It is very safe. It can get complicated but it's genuinely difficult to get yourself in to an unworkable jam, so it's safe to experiment.

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,979 image

    This is prefectly fine, however if you share the doc with somebody else they will open the doc in Main by default and not see your branch unless they go looking for it. The workaround is to send them the URL to the branch. If Main is of no use anymore, you could also just merge your branch into Main, overwriting everything that is in Main. One question though - any particular reason you are creating versions every few minutes?

    Senior Director, Technical Services, EMEA
  • jason_ryan337jason_ryan337 Member Posts: 71

    Thanks so much!! That was really stressful and the directions were really helpful! I would have never thought to merge from Main to B1.

    @NeilCooke good question, lol. I am sure that I am not using this correctly so I welcome your advice :-).

    I think there are three things causing me to rev too often. First was that I used to just duplicate the workspace to set safe restore points (I also did not know how to use versions). Over a period of a couple weeks, I may have 30 duplicate tabs. As I watched more people use OnShape, I felt like they don't do that and that they must be using version control.

    Second is that I am developing a new tool to use with Amalgamate and to test it across documents, it makes me point to the newest rev to get the latest. When I try to test it within the "current document" it still strangely points to an older rev even though the Main branch has updates. So this drives most of the frequent revs.

    Lastly is just a general fear I have of losing past progress and running out of "undo" to get back to my last stable point. Thanks again for the guidance!

  • jason_ryan337jason_ryan337 Member Posts: 71

    Sorry another maybe silly question, but I made some changes in the main branch that did not pan out. How can I roll the main back to the previous revision 82?

    image.png
  • CADNurdCADNurd Member Posts: 82 ✭✭

    Sorry to sidetrack the conversation, but the image above confuses me.

    It challenges my own understanding of Versions, which I thought were view-only snapshots to be used as branching-off points. Yet V82 in the image above says it contains '3 changes' ??? How could that have happened?

    Unemployed Onshaper - Operating on European time - More of me here ➤➤ https://linktr.ee/Liam.G

  • joshtargojoshtargo Member Posts: 491 EDU

    probably 3 changes from from the previous version

  • joshtargojoshtargo Member Posts: 491 EDU

    While on main, right click on v82 and say restore to main

  • nick_papageorge_dayjobnick_papageorge_dayjob Member, csevp Posts: 1,074 PRO
  • jason_ryan337jason_ryan337 Member Posts: 71

    Thanks. I clicked on main and went to v82 and chose restore to main. Now it says that they are the same, but the branch history still shows there are 8 changes so I'm not sure what is right.

    image.png

    image.png
  • CADNurdCADNurd Member Posts: 82 ✭✭

    Ok. But that's baked-into the version right? There's no way to change that number from 3 to 2 or 5?

    Unemployed Onshaper - Operating on European time - More of me here ➤➤ https://linktr.ee/Liam.G

  • nick_papageorge_dayjobnick_papageorge_dayjob Member, csevp Posts: 1,074 PRO
    edited February 15

    correct. It’s the number of changes made “between” versions. (Or between the last version and the workspace). Usually it’s dozens or hundreds of changes so it doesn’t show a number. Only when it’s a handful of changes it populates a number.

    The only caveat to that is you can retroactively make a version anywhere between two existing versions. That would change the number.

Sign In or Register to comment.