how to create local copy of remote svn repository?

Oleg Vazhnev picture Oleg Vazhnev · Jan 19, 2012 · Viewed 25.4k times · Source

I have remote svn repository. I want to check-out it (with history) and then use in Visual Studio as regular repository. After a while I will submit (commit changes) from local repository to remote repository (and also update files if any).

So it seems I just need two copies of svn repository and I need ability to synchronize them.

How to do that?

Answer

vcsjones picture vcsjones · Jan 19, 2012

That goes against what SVN is. What it sounds like you want is a DVCS like Git or Mercurial, hence why many developers have moved to something like that.

I would use git; and use the git-svn bridge to be able to communicate back to your SVN server.

Git keeps a full copy of the repository when you clone from SVN (which means the initial clone can take a long time since it needs to checkout every single revision). You would then commit locally to your Git repository; and dcommit (push) back to your SVN repository.

I don't know of any clean ways to do this using SVN alone. A typical workflow might be:

git svn clone http://yoursvnserver/svn --username vcsjones

#make some changes
git add -A
#stage your changes. add -A stages all changes;
#you can stage individial files too or use git add -i for interactive adding
git commit -m "My commit messages"

#repeat makes changes and commit as many times as you want
git svn dcommit
#commit all local commits back to the SVN repository.

If you are a one man shop; keep your repository on a USB flash drive (and just make sure it gets backed up somehow incase you lose it; it becomes faulty).