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 switch
in 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 switch
because you don't want to lose your work, you could do the following:
svn switch
on one to make that trunk.svn co
or svn switch
to get a trunk working copy. Then use svn merge -r
to merge your changes into trunk. And, of course, test your changes before committing them.*Subversion does allow mkdir
, cp
, mv
, and rm
to work directly upon a URL, but that's mainly to allow you to manipulate branches without having to create a working directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With