Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a local SVN branch

I am working on an SVN repository and do not want to create a new SVN branch. Instead of that, I want to create a branch local to my machine, something which could be done easily with Git.

But I am currently using SVN and need to branch out from an already-modified SVN version. In essence, I want following:

  • svn_repo_version = 2259
  • working_copy = modified 2259
  • new_local_svn_branch = based on modified 2259

What is the best way to go about it?

like image 795
agent.smith Avatar asked Jun 01 '11 19:06

agent.smith


People also ask

How do I create a folder in svn repository?

One way is to browse the repository to the place where you want to insert your new directory and right-click and select "Create Folder". Then right click the folder and check it out to the location where you want it. Then copy the directory of files you want to put into SVN into the folder created by the checkout.


2 Answers

Subversion is a centralized version control system. Some of the advantages of a centralized system is that it forces everyone to play with the same codebase. You can't hide your work for months at a time, then suddenly plop it down two days before a major release. The bad part is that you can't truly have a private branch and not have it show up in the repository.

There's no reason why you shouldn't be able to create your own branch. In fact, I use to give our developers a special "private" directory where they could put their own code, and do private branching. I had a pre-commit script that only allowed the owner of the branch to make changes, although I had it setup, so anyone could see it.

If you're worried that your private branches might clog up the branches directory, remember you can remove a branch from the branches directory when you're done. Or, you can request a parallel private directory where you can put your stuff.

If you really want to create a true private area where you can use Subversion and check in code without it appearing in the main repository, you have two choices I know of:

  • SVK: This is a front end distributed version control system that uses Subversion on its backend. You can create your own Subversion repository, and post changes back and forth between your local repository and the master repository.

  • Git: Git comes with a tool called git-svn which allows you to pull data off of a Subversion repository into a local Git repository. You can then use your local Git repository to do your branching, and later push your changed back into Subversion. There's even a Git version of Tortoise.

The only caveat is that you will have to get your hands dirty with the command line interface with both of these tools.

like image 134
David W. Avatar answered Sep 28 '22 03:09

David W.


I'm afraid you will have to create a new branch and keep merging any changes into it. The only alternative is to simply checkout the branch, keep updating and don't commit (or keep switching prior to commits) until you are finished. You could always have two working copies if you need to work on the original branch/trunk. Nowhere near ideal, but that's the way SVN works, which is still very good given the alternatives at the time.

I personally manage local history if that is what you are after via my IDE (Eclipse).

like image 26
vickirk Avatar answered Sep 28 '22 04:09

vickirk