views:

154

answers:

2

This might be a dumb question but I'm unable to understand:

When we create a new branch, why do we need to 'switch'? What does this 'switch' exactly do? Can't I use the whole repository as I was using earlier without bothering about switch?

+3  A: 

Using switch will update your working copy to use the new branch you just created.

As an example, if you create a branch from your trunk, you will probably want to switch your working copy over to the branch you just created so that you can make edits, etc.

Trevor
You can just let your working copy the way it is, and check the new branch out in another folder.
Jan Jongboom
@Trevor: Does that mean if I'm working on 'trunk' and a 'branch' simultaneously, I've to switch between these 2 everytime? As you've explained, answer is probably yes?
understack
Switching is optional. If you have two working copies (trunk and branch), then you don't need to switch. Switching is helpful when you only have one working copy and want to switch between branches or trunk.
Trevor
+2  A: 

Switch changes the association between your working copy and the path on the server. You can branch from your working copy from trunk (for maintenance) and continue hacking away - still on trunk.

Benjamin Podszun
@Benjamin: This makes sense. Thanks.
understack
@Benjamin: Isn't this association saved somewhere inside .svn directory?
understack
Yes, it is. That's what the switch updates/changes: The reference or association to the server repository path.
Benjamin Podszun
What about switching on a single folder in your working copy...does the same?
CoffeeAddict