I am working on a code usually in trunk but due to recent changes I had to switch my workspace to a branch.
Is it possible to commit any change in the trunk while working in a branch without actually switching the project to trunk
I basically want to commit changes in both trunk and branch without switching back and forth again and again
The short answer: No
This is why God created
svn switchin the first place. It allows you to change your underlying branch of your working directory without losing your work.Think of it this way: How many times has a developer broke something because they’ve said to themselves “Hey, I don’t have to test this. It’s a minor change”?
Even if Subversion allowed you to do what you want, it would still be a bad idea. You’d basically be making changes in a codebase with no real way of making sure they work in the first place. This is why Subversion requires you to have a working directory before you can make changes*. How would you test your changes?
If you don’t want to use
svn switchbecause you don’t want to lose your work, you could do the following:svn switchon one to make that trunk.svn coorsvn switchto get a trunk working copy. Then usesvn merge -rto merge your changes into trunk. And, of course, test your changes before committing them.*Subversion does allow
mkdir,cp,mv, andrmto work directly upon a URL, but that’s mainly to allow you to manipulate branches without having to create a working directory.