Search code examples
svnversion-controlmergetortoisesvnsubclipse

SVN switch to a different branch, allowing me to merge/commit later


Seems like I should be able to do this using Subclipse or Tortoise.

I began work on a feature in a branch and the scope of that feature grew, so I am not checking in to keep that branch stable. I want a place to check in, so I've branched the original branch, and I'd like to point my copy to that branch.

Using SVN switch, it seems I must resolve conflicts as part of the process, but I am not prepared to do that. I just want my workspace to now point to the copy of the branch it was pointing to before, allowing me to merge and update on my own time.

Is there a way to do this?


Solution

  • switch has to do an update. I do not think your issue is with switch, it is probably with the branch you created. Suppose your working copy is updated to r100 of your repository and you start making changes locally. Now you decide to create your branch and you create it based on the repository HEAD which is not at r150. Then yeah, you might have some problems because the branch was not really created from the same source as your working copy.

    If you want to optimize around making it easy to stash your change, then the best thing will be to create your branch from the working copy. This is one of the options in the wizard when you select your project and choose Team > Create Branch/Tag...

    Working copies can be in crazy mixed-revision states and that is what the branch will be created from. So it can be a little more difficult later when you want to go back to your change and want to merge it back to trunk or get the branch caught up with trunk.

    If you have a rough idea what revision your working copy is up to, then the middle-ground approach would be to create the branch against the repository revision. Then the branch is clean and you minimize the likelihood of conflicts when you update the working copy with the switch.