SVN how do I check code into a specific branch, when I've checked code out from the trunk?

20,357

Solution 1

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.

Solution 2

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.

  1. Right Click on the Directory in question you want switch.
  2. Select TortoiseSVN | Switch
  3. Change the Repository Location from the current one to the new location.

The documentation for this can be found here.

Solution 3

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/

Solution 4

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.

Solution 5

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.

Share:
20,357
qodeninja
Author by

qodeninja

I write qode mostly for myself... out of curiosity for solving problems, understanding how things work or making (sometimes unnecessarily) complex systems to only simplify them later (once I discover alternative strategies). For whatever reason, I like torturing myself with Regular Expressions, SED, Bash and JavaScript (Node), but have found a growing (painful) love with Python. Having said that, I enjoy scripting languages a lot more than compiled languages, and I've coded in almost all of the major modern ones except Ruby. I'm a secret Turing Machine/Computer Grammars/Regular Expressions nerd, and have written my own mini compilers and toy languages. I'm constantly writing command dispatchers that I later write scripting languages for; it's an addiction. There's plenty room for me to grow and learn still; and I appreciate the wisdom of grey beards and lady wizards even if I don't always follow their sage advice. FOSS is hella cool; cool projects are cool. Find me online if you have ideas. I'm a really bad programmer but I'll write a line or two for the betterization of the peoples. Edit: I recently discoved that VI is really just SED with wings. Still not using VI. Nano or bust.

Updated on October 31, 2020

Comments

  • qodeninja
    qodeninja over 3 years

    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 =/

  • qodeninja
    qodeninja over 14 years
    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.
  • Michael Hackner
    Michael Hackner over 14 years
    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.