Home

August 24th, 2006

09:20 pm
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.