Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

svn branch commit - experimental commit

Tags:

branch

commit

svn

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?

like image 283
quano Avatar asked Mar 13 '10 23:03

quano


1 Answers

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.

like image 140
Greg Hewgill Avatar answered Oct 22 '22 08:10

Greg Hewgill