dserodio ([info]dserodio) wrote,
  • Mood: Tired
  • Music: DJ Tiesto - Smirnoff Experience

How to branch with Subclipse

Nice advice on the subclipse-users mailing list by Mark Phippard
Easy way:
  1. Team -> Create Branch/Tag Specify URL to store it, and be sure to select option to create from working copy. Since your project is still on trunk after this completes, you have to do a Revert to get the project back to a pristine condition.
  2. Use Team -> Switch when you want to go back to the branch code.

Better way:
  1. Do Team -> Update on your project so that your entire working copy is updated to a single, known revision.
  2. Do Team -> Create Branch/Tag and create a branch directly in the repository using that known revision.
  3. Do Team -> Switch to swap your working copy to the branch. Since it was already based on that revision, this will be quick and simple.
  4. Do Team -> Commit to commit your changes to the branch.
  5. Do Team -> Switch to swap back to trunk.

Why is this "better" when it is so many steps? It separates the creation of the branch from the commit of your changes. This makes it easier to create a patch with your changes, or to later merge them back to trunk. The "easy" method is fast and simple way to stash your changes but it will be harder to later reintegrate those changes to the trunk.
Tags: subversion eclipse tips

  • Post a new comment

    Error

    Your IP address will be recorded 

  • 7 comments

[info]bpfurtado

September 1 2006, 11:15:32 UTC 5 years ago

Nice tips! most of users I've worked don't even know that Branch exists. Good tips on that are always welcome :) As source code versioning tools are one of the most important in our field.

[info]rickwoods

May 15 2009, 18:18:08 UTC 3 years ago

Thanks! This entry was one of the first few hits on Google for "subclipse commit branch" :-)

Anonymous

September 16 2009, 14:07:10 UTC 2 years ago

Is this also possible with multiple users

Hi,
I wondered if the switch is also possible if multiple users are working on one project?
Lets say i spin of a copy of my trunk version to a branch, then i switch it so that it appears to me the branch is in my trunk. then i develop....
Does this switch also affects now my colleage who works on the trunk?
Please if someone knows just post it here

[info]dserodio

September 16 2009, 14:49:45 UTC 2 years ago

Re: Is this also possible with multiple users

If your working copy was switch'ed to a branch, you'll commit to this branch and the trunk won't be affected.

The trunk will only be affected when you merge your changes to from the branch to the trunk .

Regards,
Daniel Serodio

Anonymous

July 6 2011, 01:21:02 UTC 10 months ago

very informative

what I was looking for, thanks

Anonymous

July 15 2011, 19:18:31 UTC 10 months ago

Re: very informative

Um, I think the context menus have changed for subclipse since 2006. I'm not sure if this is the correct way but, it seemed to work for me for the lastest build of subclipse in helios. It's certainly not intuitive or obvious to a n00b like me.

  1. Checkout trunk of my project
  2. Right-click on the project, Team --> "Update to head"
  3. Right-click on the project, Team --> "Branch/Tag..."
  4. Select the branches folder url and append a new branch name, hit the Next button, hit the Next button again, skip the comment and press the Finish button.
  5. Right-click on the project, Replace With --> Branch/Tag...
  6. Select your new branch
  7. Confirm your svn label is your new branch on your project now. Make your changes. Commit your changes to your branch.

Anonymous

August 5 2011, 16:27:29 UTC 9 months ago

Most Helpful

Thanks for the tips! I was struggling to create a branch from the SVN Repository perspecitve. Doing the work from the Team menu worked like a charm.

Thanks..
Create an Account
Forgot your login or password?
Facebook Twitter More login options
English • Español • Deutsch • Русский…