I need to check in my code changes to a certain branch but im not sure how to do that since my code is from trunk =/
-
Thanks guys. So how do I use SVN switch? I have IntelliJ and TortoiseSVN on a Windows XP box – qodeninja Oct 29 '09 at 20:42
-
Should I just check out the branch, load my code changes into it, and then check out from there? – qodeninja Oct 29 '09 at 20:45
-
You can do a switch or that. I edited my Answer to include how to switch with TortoiseSVN. I personally use switch all the time. – Robert Love Oct 29 '09 at 20:50
7 Answers
cd workingcopy svn checkout http://my.repos.com/path/to/trunk # make your edits svn switch http://my.repos.com/path/to/branch svn commit
Now your working copy points to the branch instead of the trunk. You could also check out the branch as a separate working copy, then drag-and-drop your changes into it.

- 8,605
- 2
- 27
- 29
-
the last part im considering since i dont know how switch will impact the repository or my code, and i dont want to break anything... so i guess it's best practice to figure out which branch my code changes are going to in advance of checking things out. – qodeninja Oct 29 '09 at 20:51
-
2`switch` is just like `update`, but with the added ability to let you point to a different location in the repository, like another branch. It won't make any structural changes to your repository — it just changes which part of the repository that working copy is looking at. – Michael Hackner Oct 29 '09 at 20:56
Using Switch allows you to change a checkout from one repository location to another, such as Trunk to a branch.
Then you can commit the changes to the branch.
Using TortoiseSVN you can Perform Switch doing the following.
- Right Click on the Directory in question you want switch.
- Select TortoiseSVN | Switch
- Change the Repository Location from the current one to the new location.
The documentation for this can be found here.

- 12,447
- 2
- 48
- 80
You need to have a working copy of the branch you want to commit to. So check it out in a separate directory, or use svn switch
.

- 53,118
- 13
- 86
- 159
In addition to switching, you can also create a patch.
http://ariejan.net/2007/07/03/how-to-create-and-apply-a-patch-with-subversion/

- 97,670
- 29
- 122
- 130
I'm not sure of the exact situtation, but it might be an idea to merge changes in to the branch.

- 792
- 5
- 19
I'm not sure of the exact situtation, but it might be an idea to merge changes in to the branch
or
You need to have a working copy of the branch you want to commit to. So check it out in a separate directory, or use svn switch.

- 13
- 2
Ok I found a way to do this. Check out the branch, copy code changes, and the recommit from checked out branch =]

- 10,946
- 30
- 98
- 152