I've made some experimental code that I would like to save in the repository, but I don't want it on the main branch. How would you commit this to a branch?
Maybe I got this wrong, but of what I've understood about branching, all you actually do is copying already checked in code to another directory in the repository. I suppose one could copy the main branch to another location, and then change the working copy repository location pointer to point at that location, and then commit the experimental code. But that seems a bit long-winded. Is this really how you do it?
That is indeed how you do it (at least in Subversion). For example:
svn cp svn://server/repo/trunk svn://server/repo/branches/experiment svn switch svn://server/repo/branches/experiment svn commit -m "testing stuff"
The Subversion cp
(copy) operation is designed to be very cheap and doesn't actually make a copy of all the code in your repository again. It just sets up pointers to point to the revision you copied from in trunk
.
Not all systems work this way; for example in Git you can create a new branch and switch to it with one command: git checkout -b experiment
.
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