Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I properly branch post-commit and revert the trunk in svn?

Tags:

branch

svn

I have some commits that I've decided, after the fact, are going to be more branch work then trunk work. How do I create the branch and revert the trunk while still ensuring merging isn't painful later?

Is it as simple as copying the current trunk to a branch and reverting the trunk? Or will this create headaches later?

like image 910
Dane O'Connor Avatar asked Sep 29 '08 14:09

Dane O'Connor


People also ask

How do I switch from SVN to trunk branch?

To switch back, just provide the URL to the location in the repository from which you originally checked out your working copy: $ svn switch http://svn.red-bean.com/repos/trunk/vendors .

What is trunk and branch in SVN?

The trunk is the main line of development in a SVN repository. A branch is a side-line of development created to make larger, experimental or disrupting work without annoying users of the trunk version.


1 Answers

I think Philips method would be something like the following, assuming the last "good" revision was at 100 and you are now at 130, to create the new branch:

svn copy -r100 svn://repos/trunk svn://repos/branches/newbranch
svn merge -r 100:130 svn://repos/trunk svn://repos/branches/newbranch

Note the idea is to preserve the changes made in those revisions so you can apply them back to trunk.

To revert trunk:

svn merge -r130:100 .
svn ci -m 'reverting to r100 (undoing changes in r100-130)' . 

(It wouldn't matter which order you performed these in, so you could revert trunk before creating the branch.)

Then you could switch to the new branch you created in the repo:

svn switch svn://repos/branches/newbranch workdir
like image 121
Sam Hasler Avatar answered Oct 12 '22 21:10

Sam Hasler