Eclipse switching branch from branch to trunk

18,077

Solution 1

This is perfectly normal, and the way the svn switch is suppose to work.

Here's a common scenario. You're working on trunk, and realize that your changes should be applied to a branch instead. You simply do switch and you are now on a new branch and your changes are now applied to the new branch. Many times, I'll be working on one stream (a branch or trunk), and realize that my changes are too experimental and big to go into the current development stream. I'll create a new branch and switch to it.

There is no reason with gigabyte fast disks, and gigabyte networks to be skimping on working directories. I tell developers to dedicate a working directory for each project and branch. Otherwise, if they keep switching back and forth between various development streams, they're going to forget and do development in the wrong place.

Solution 2

With almost any svn client you can:

  1. check out a project
  2. make some changes
  3. switch back and forth to any truck/branch
  4. preserve your changes along the way

In other words, nothing specific to eclipse here.

see: svn switch

I prefer to have separate eclipse projects per branch and also change the project name to something like myProject-24 so when the branch is checked out again down the road, the default project name has some branch identifier on it.

This also enables you to make changes on a per branch level and do single commits across the branches; even if they're in discreet eclipse projects.

Solution 3

The functionality you are looking for can be reached by doing the following

  1. Right Click on the folder that should be replaced
  2. Click on "Replace With ..." from the context menu
  3. Click on "Branch ..."
  4. Select the branch you want to take a look at from the dropdown box

ATTENTION: This is replacing your local changes. It is not possible to reverse this.

Greetings Tobi

Share:
18,077

Related videos on Youtube

Dave
Author by

Dave

Updated on September 15, 2022

Comments

  • Dave
    Dave over 1 year

    I don't understand something that is happening on my Eclipse and I am wondering if this is my Eclipse problem or if this is actually a feature. I have a trunk and a branch. On the repository they are the same so no changes have been commited since I created the branch. After making the branch I switch on my workspace the project from trunk to branch. Then I started working and changing on the branch. Suddenly I wanted to see something on the trunk because I got lost in my changes. So I switch to the trunk. I was surprised when Eclipse did not remove my changes and it was as if no switch was made. The changes continued being there.

    Is this normal? Can someone explain? Thanks, David