Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TortoiseSVN switch Branches

Tags:

I have used svn for a while but recently a couple teams were added to the project. One of the teams made a new branch and has asked me to check some of their changes. I went to the directory, right click, svn->switch and chose the new branch. I went in and tried to echo something to the page I was on to see if I was working in the new branch and I wasn't. This is a little beyond what I do but with the project getting so big I need to learn this.

Based on that, my question..is there something more to this that I am not doing? After switching the working copy to this new branch how do I work on it?

like image 307
Webtect Avatar asked Oct 31 '12 17:10

Webtect


People also ask

How do I switch between branches in SVN?

To switch back, just provide the URL to the location in the repository from which you originally checked out your working copy: $ svn switch http://svn.red-bean.com/repos/trunk/vendors .

How do I move my TortoiseSVN repository?

If you are using TortoiseSVN (and I'm sure there's a command line tool for this as well, but I'm using Tortoise), you can simply right-click on your existing working copy folder and select TortoiseSVN –> Relocate. In the dialog that comes up, enter the new location of the repository, and click OK.


2 Answers

The difference between checkout and switch might be adding to the confusion. I think that in your case it would be simpler to just check out the branch to a different folder since you're just doing review and it may be the most straightforward way to proceed regardless.

See this section from the Tortoise docs:

To Checkout or to Switch...

...that is (not really) the question. While a checkout downloads everything from the desired branch in the repository to your working directory, TortoiseSVN → Switch... only transfers the changed data to your working copy. Good for the network load, good for your patience. :-)

To be able to work with your freshly generated branch or tag you have several ways to handle it. You can:

TortoiseSVN → Checkout to make a fresh checkout in an empty folder. You can check out to any location on your local disk and you can create as many working copies from your repository as you like.

Switch your current working copy to the newly created copy in the repository. Again select the top level folder of your project and use TortoiseSVN → Switch... from the context menu.

In the next dialog enter the URL of the branch you just created. Select the Head Revision radio button and click on OK. Your working copy is switched to the new branch/tag.

Switch works just like Update in that it never discards your local changes. Any changes you have made to your working copy which have not yet been committed will be merged when you do the Switch. If you do not want this to happen then you must either commit the changes before switching, or revert your working copy to an already-committed revision (typically HEAD).

If you want to work on trunk and branch, but don't want the expense of a fresh checkout, you can use Windows Explorer to make a copy of your trunk checkout in another folder, then TortoiseSVN → Switch... that copy to your new branch.

like image 143
Paul Sasik Avatar answered Oct 26 '22 03:10

Paul Sasik


In the regular "Properties" dialogue (right click on Windows explorer) you have a "Subversion" tab that will tell you what URL the file or directory points to. Use that to verify that you actually switched to the correct branch.

It's also worth nothing that any non-committed local changes will still be in your working copy.

like image 21
Álvaro González Avatar answered Oct 26 '22 04:10

Álvaro González