Turn Current Working Trunk Into a Branch in SVN

So you start working inside of a trunk checkout of a Subversion repo, thinking that you will just be making a quick update. Once you start working, you realize it might have been better to make a branch to work on the feature separately from the trunk? Fear not! As Floyd Price from CodeSpaces points out, the process is pretty simple when you think about what you want to get done.

Technically, if you have not committed the changes into the trunk yet, you are dealing with the most up to date version of the trunk. If you were create a new branch from the trunk, they’d both be on the same page, sans your new edits.

Your current trunk checkout: A + B
               A new branch: A

To make the new branch, run:

#svn cp trunk_repo_path branch_repo_path/new-name
  svn cp http://example.com/repo/trunk http://example.com/repo/branches/new-branch

Now, in your current trunk repo check out you’ve been working in, switch the URL to be the new branch

svn switch http://example.com/repo/branches/new-branch .

If you run `svn st`, you will see the same modified files, but if you run `svn info` you will see the checkout’s URL now points to the branch, and you are free to commint

svn commit -m "first of commit new feature"

Hope this helps.

Remove Your Folder From SVN

Did you ever have a folder that was nested with .svn folders and you wanted to quickly remove them and just make them a non-versioned folder? Perhaps because you are going through old repo checkouts that are too out of date to care, or you want to copy a repo-ed folder to a new project without it being externalled, or maybe because the folder got screwed up on a commit and you just want to recommit it? Try running this unsvn code.

find . -name ".svn" -exec rm -rf {} \;

Just save this code to a file (I call mine “unsvn”), run it from the parent level directory and it will remove all .svn folders in itself and all of it’s children.