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.

How to merge a branch back into main?

cory_isaacsoncory_isaacson Member, Developers Posts: 43 PRO
This is a question that I have the answer to (which I'll provide right after this), which I provide here. In the documentation and other discussions, I didn't see an explicit explanation of this.

Here is the flow:

  • Build some parts, assemblies in the Main branch
  • Create one or more versions of Main as you work and want to mark the state of your work
  • Come up with a new design approach for some of the parts you want to test
  • Create a branch B1 for your new designs, editing the same parts/assemblies that you had in Main
  • The new design works much better and now you want B1 to be Main again
So what steps exactly do you take to do this? The answer is very simple, and follows.

Best Answer

  • cory_isaacsoncory_isaacson Member, Developers Posts: 43 PRO
    Answer ✓
    Here is how you do this.

    • Be sure that you created a final version of B1 with your changes the way you want them
    • Open the Main workspace again by clicking Main in the Version manager, this makes Main the current workspace
    • Right click the B1 version you want to use to merge into the Main workspace
    • Select the Merge into current workspace option
    • Now all B1 modifications are in Main and you are set to go
    • I usually then make another version of Main to note what I did after the merge
    This works very well, the modifications in B1 (Source) override the original Main (Target).

Answers

  • cory_isaacsoncory_isaacson Member, Developers Posts: 43 PRO
    Answer ✓
    Here is how you do this.

    • Be sure that you created a final version of B1 with your changes the way you want them
    • Open the Main workspace again by clicking Main in the Version manager, this makes Main the current workspace
    • Right click the B1 version you want to use to merge into the Main workspace
    • Select the Merge into current workspace option
    • Now all B1 modifications are in Main and you are set to go
    • I usually then make another version of Main to note what I did after the merge
    This works very well, the modifications in B1 (Source) override the original Main (Target).
  • 3dcad3dcad Member, OS Professional, Mentor Posts: 2,475 PRO
    edited April 2017
    If you plan to test different approaches using branch & merge you should take a minute to understand how it works.

    I've had few cases where I go like this
    - Work in main branch and create 'milestone' versions
    - At some point create B1 to try something alternative
    - Maybe still continue with Main and make some adjustment into dimension and edit some sketches etc.
    - Come to a conclusion that B1 is the way to go

    So I would need to merge stuff that lives in same sketches & features under Main & B1. If I go with merge into Main, I lose any modifications that are made to Main after branching if they are made into sketches / features that also exist in B1.

    To be effective with branching, make all the modifications into single branch and then merge. Or modify by creating new features since merge will not merge two sketches into one but just adds and overwrites features into single list.
    //rami
Sign In or Register to comment.