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.

Merging to bring a tab into a branch

shawn_crockershawn_crocker Member, OS Professional Posts: 865 PRO
I have a concept I'm trying to test the plausibility of.  I make a branch.  I delete everything in the branch except one tab and then create a version.  In the main branch, I delete that one tab that was left in the new branch and I then create a version.  When I merge the new branch back into the main branch, I get a workspace that has nothing in it.  How can I rearrange the steps I am taking so that I end up with the main workspace just like it was before the merge but with the tab from the other branch merged in?
Tagged:

Best Answers

  • romeograhamromeograham Member, csevp Posts: 676 PRO
    Answer ✓
    What about removing your tab deletion steps? I think you don't want to delete all the other tabs - that's telling Onshape "I don't want these tabs" so when it merges from the Source Branch to the target branch, it removes them. I think the best thing is to leave the ones that you don't want to change unchanged...so the merge has no effect.

    (if you have successfully merged workspaces / branches in the past while deleting the tabs that will be replaced - and it's not working this time - I don't know what's going on.  I do think that the very existence of tabs is part of what gets merged....so you are telling Onshape that you don't want some of your tabs at all, not that you want to replace a tab that doesn't exist with a tab that has your desired features in it).

  • eric_pestyeric_pesty Member Posts: 1,877 PRO
    edited June 2022 Answer ✓
    @eric_pesty
    One issue I have with merging the winner is that, it is the winner.  If I merge it, suddenly it will no longer be the same as it will take on some of the features of the other branch.
    Couple more thoughts, obviously it depends on your actual scenario...
    The way I would typically use a branch is to develop "one aspect" of the design, say a bracket and design one in sheet metal and one machined (made up scenario) in two different branches. These branches would only have the changes relevant to this bracket (mounting holes in another part for example), but I might be waiting for quotes to decide the winner and want to work on some other aspect of the design (say a cover). Assuming the cover design isn't affected by the bracket, I would do that work in the "origina" branch, and then later I can pick the best of bracket design and merge that branch (and only that branch!) so I end up with new cover I designed in the main branch and the bracket. And maybe I have to do some tweaks in the cover if the bracket did affect it after all...

    Another scenario is if I am going to do some major design concept changes in a couple separate branches to "test them out". In that case I probably won't be making any changes in the original one so that when I merge back the original is the same as the winner.

    One third potentially related thing to be aware of that I think would be the answer to your question above is that, if for some reason you did make changes to your original branch while you were working on your concept branches, but want to discard them (so that it's only the "winner" that remains), that is easy to do: all you have to do is restore the main branch to the version you created your branch from before merging, this results in your "original" branch being exactly identical to the "winner" your merge in. Hope that makes sense!

     Edited to add:
    The one thing you want to make sure you don't do is make changes "same thing" (and I mean the same "design feature" for example edit the mounting hole of the same bracket in two branches that are going to be merged, then you will have a conflict when you try to merge. But it's ok to edit the mounting holes in one side of the bracket in one branch and the "other end" in a separate branch as these will still "play nice" after merge.

Answers

  • romeograhamromeograham Member, csevp Posts: 676 PRO
    Answer ✓
    What about removing your tab deletion steps? I think you don't want to delete all the other tabs - that's telling Onshape "I don't want these tabs" so when it merges from the Source Branch to the target branch, it removes them. I think the best thing is to leave the ones that you don't want to change unchanged...so the merge has no effect.

    (if you have successfully merged workspaces / branches in the past while deleting the tabs that will be replaced - and it's not working this time - I don't know what's going on.  I do think that the very existence of tabs is part of what gets merged....so you are telling Onshape that you don't want some of your tabs at all, not that you want to replace a tab that doesn't exist with a tab that has your desired features in it).

  • shawn_crockershawn_crocker Member, OS Professional Posts: 865 PRO
    Hmm.  Looks like I have failed again to actually find a way to make use of the merge feature.
  • romeograhamromeograham Member, csevp Posts: 676 PRO
    edited June 2022
    It can work really well - just not super-intuitive. Totally legit workflow: version main branch - create "dev" branch - do work in 1 or more tabs in the dev branch - merge back to "main" when you are ready.

    Just no need to delete the stuff that's getting replaced (or is unchanged)...that's what the "merge" is for! 
  • shawn_crockershawn_crocker Member, OS Professional Posts: 865 PRO
    create "dev" branch - do work in 1 or more tabs in the dev branch - merge back to "main" when you are ready.
    This is what sort of gets me a bit with merge.  If the changes are good in the dev branch, why not just leave them there?  Why merge back in?  It seems like such a rare occurrence where you want to keep some changes in one branch and some in another.  What I was trying to do with merge is exactly that but the inverse.  I want to keep the things I didn't change in one and the things I didn't change in the other.
  • eric_pestyeric_pesty Member Posts: 1,877 PRO
    Just a thought, and maybe I am missing something, but if you are going to work on a "new tab" only, then there is no point in branching/merging at all!
    You can create that new tab in your main branch and work on it (or even in a different document and "move it in" after)...

    Branching is when (one example use case anyway) you want to test some changes to your existing stuff but not sure if you want to keep it. Or maybe you need to modify something but there are two ways of doing it you want to investigate (each requiring some changes to multiple tabs) so create two branches to test out the two concepts "in parallel" and then only merge the "winner".


  • shawn_crockershawn_crocker Member, OS Professional Posts: 865 PRO
    edited June 2022
    @eric_pesty
    One issue I have with merging the winner is that, it is the winner.  If I merge it, suddenly it will no longer be the same as it will take on some of the features of the other branch.
    To put this branching thing another way.  I'm trying to use branches as a separate document.  Why not just use a separate document?  Because it makes it annoying when the parts are almost certainly only going to be used in the top level product assembly.  Its nice for releases to all be nice and tidy in the same document.  Separate documents is also not as clean I have found starts feeling like I'm working with files again with stuff flying all over the place.  Its also annoying to do additional major development with versioning.  I can move the tab into the document for changes and then back out but it feels wrong.  Not being able to effectively get the tab with proper associativity back into the main workspace is what is killing this branching method I am attempting to try.
    I will probably continue the same as usual.  Create a versions for special items and switch items to reference back to there designated versions.  It works extremely well but I just don't like to see many in progress, basically redundant versions of these special items in the search.  I feel like I am bloating things up for some reason.
  • eric_pestyeric_pesty Member Posts: 1,877 PRO
    edited June 2022 Answer ✓
    @eric_pesty
    One issue I have with merging the winner is that, it is the winner.  If I merge it, suddenly it will no longer be the same as it will take on some of the features of the other branch.
    Couple more thoughts, obviously it depends on your actual scenario...
    The way I would typically use a branch is to develop "one aspect" of the design, say a bracket and design one in sheet metal and one machined (made up scenario) in two different branches. These branches would only have the changes relevant to this bracket (mounting holes in another part for example), but I might be waiting for quotes to decide the winner and want to work on some other aspect of the design (say a cover). Assuming the cover design isn't affected by the bracket, I would do that work in the "origina" branch, and then later I can pick the best of bracket design and merge that branch (and only that branch!) so I end up with new cover I designed in the main branch and the bracket. And maybe I have to do some tweaks in the cover if the bracket did affect it after all...

    Another scenario is if I am going to do some major design concept changes in a couple separate branches to "test them out". In that case I probably won't be making any changes in the original one so that when I merge back the original is the same as the winner.

    One third potentially related thing to be aware of that I think would be the answer to your question above is that, if for some reason you did make changes to your original branch while you were working on your concept branches, but want to discard them (so that it's only the "winner" that remains), that is easy to do: all you have to do is restore the main branch to the version you created your branch from before merging, this results in your "original" branch being exactly identical to the "winner" your merge in. Hope that makes sense!

     Edited to add:
    The one thing you want to make sure you don't do is make changes "same thing" (and I mean the same "design feature" for example edit the mounting hole of the same bracket in two branches that are going to be merged, then you will have a conflict when you try to merge. But it's ok to edit the mounting holes in one side of the bracket in one branch and the "other end" in a separate branch as these will still "play nice" after merge.

  • eric_pestyeric_pesty Member Posts: 1,877 PRO
    @eric_pesty

    To put this branching thing another way.  I'm trying to use branches as a separate document.  Why not just use a separate document?  Because it makes it annoying when the parts are almost certainly only going to be used in the top level product assembly.  Its nice for releases to all be nice and tidy in the same document.  Separate documents is also not as clean I have found starts feeling like I'm working with files again with stuff flying all over the place.  Its also annoying to do additional major development with versioning.  I can move the tab into the document for changes and then back out but it feels wrong.  Not being able to effectively get the tab with proper associativity back into the main workspace is what is killing this branching method I am attempting to try.
    I will probably continue the same as usual.  Create a versions for special items and switch items to reference back to there designated versions.  It works extremely well but I just don't like to see many in progress, basically redundant versions of these special items in the search.  I feel like I am bloating things up for some reason.
    I guess I'm not sure I quite understand the point of trying to use a branch as a separate document: sure you can reference version between different branches but at that point it behaves the same way as if they were in different documents.
    I mean I understand how you can and how it works but at that point why merge them?

    Or to put it another if you ARE going to merge them, why create the branch in the first place? And maybe that's the key, I guess I don't really understand what the benefit of using branching would be in what you are trying to do, i.e. what are you trying to achieve with branching that you can't do by just creating a new tab in the main branch?
  • shawn_crockershawn_crocker Member, OS Professional Posts: 865 PRO
    @eric_pesty
    Thanks for the expert insights.  I will play around with combining restoring and merging.  I feel like you could be onto somthing there.
  • shawn_crockershawn_crocker Member, OS Professional Posts: 865 PRO

    I mean I understand how you can and how it works but at that point why merge them?
    I want to merge them to get the tab back into the main workspace to reap the benefits of instant change propagation.  I also was considering using branches because I can remove the tab from the main branch and leave it in its own space.  It feels more clear where in the history the tab exists.  As I continue developing other aspects of the design that do not involve that particular tab, that tab does not keep getting versioned over and over.  I could create a version in the main workspace for the tab and reference back to it deleting the tab in the workspace but it makes it hard to pull back into the workspace.  I was thinking branches and merging would somehow make getting the tab back for editing easier.
  • shawn_crockershawn_crocker Member, OS Professional Posts: 865 PRO
    Also, having the tab gone from the main workspace makes it more immediately obvious that no changes, even accidental ones, have been made to that particular item or group of items.  If I can get it to work, it feels like it could be a great way to feel that security of having items in separate documents while maintaining the greatness of seeing everything in one spot.
  • eric_pestyeric_pesty Member Posts: 1,877 PRO
    I think I'm starting to understand what you are saying...
    I get the part about "not versioning something" that isn't actually getting changed which does happen a lot when you have a project in a single document...

    I've kind of learned to accept that this was going to happen although it can be annoying when the part is also used in another document (where it ends up "out of date" all the time). I wish you could "pin reference to a branch" so that you could automatically ignore any new versions created in a different branch (but still get a notification when the branch it's in gets updated), that would help...

    I think the intended way to handle this is to move these to a different document (and maybe use a folder to keep them "together").

    It seems like what you are looking for is a "move to branch" function, similar to "move to document".
    This could actually be done by the "move to document" command if it let you move to the same doc (and pick a different workspace). It can be done right now but you have to move it out to some other document (even a temporary one), and then move it back from there to the other workspace. That's a few more steps obviously and creates versions in the process so I am not sure how much that helps...
  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,210
    @shawn_crocker We're looking at making some improvements to merge (more options, more clarity about what a merge will do) that I think will address some of the use cases you're talking about.
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • shawn_crockershawn_crocker Member, OS Professional Posts: 865 PRO
    I have actually done this before by moving to a temp doc and then back in.  I'm feeling more comfortable with just having lots of redundant versions of a things than doing that.  It doesn't really take long either, it just feels like for some reason it will bring unforeseen trouble down the road by making it a habit.

    I actually have an improvement request open called "

    UPDATE PART VERSION ONLY WHEN NEW VERSIONS EXIST IN THE SAME BRANCH"

    It deals with what you have said here. "I wish you could "pin reference to a branch" so that you could automatically ignore any new versions created in a different branch (but still get a notification when the branch it's in gets updated), that would help...".

    Being able to directly move a tab to a new or existing branch within the same document would most certainly resolve this desire I have.  I may go ahead and make a request for this if one isn't already made.  There is an article out there discussing this but I can't remember if it was an improvement request or not.
  • shawn_crockershawn_crocker Member, OS Professional Posts: 865 PRO
Sign In or Register to comment.