views:

675

answers:

7

At my place of work, we use SVN and TortoiseSVN (Windows XP) as a client. I have a longish commute and work offline during that.
Now, I'd like to have some sort of "extended undo" locally; i.e. I would like to have local version control of my SVN working copy, in order to dare to refactor for example.
Switching altogether to e.g. git, mercurial etc. is not an option as the company uses SVN.

What I'd like to know is if someone has any experience in versioning the local SVN working copy, perhaps by running a local git or similar?
Are there any potential drawbacks? (perhaps messing with .svn folders or similar)

+3  A: 

I use Git as a local Subversion client for work and it works great. When you do a git svn clone of a Subversion repository, the checkout you get does not have the hidden .svn directories, but instead is a complete Git repository in its own right. The ability to use local, lightweight branches to organise my own development is a killer feature for me.

Other features I use all the time are git stash, staged commits, and git add -p.

Greg Hewgill
Is this on Windows?
Niklas
Actually that's on OS X and Linux. I see that you're using Windows and I know that git-svn at one time didn't work on Windows; perhaps it does now.
Greg Hewgill
Nope, git-svn doesn't work very well on windows - at least when using MSysGit.
Marcin Gil
what's a pity git-svn can't use on Windows.
Cooper.Wu
A: 

Last time I checked the status of SVN, local checkin support was still a long-term feature plan. Git, on the other hand, is definitely an option, with git-svn. That is, if your architecture is Unix, AFAIK, git-svn is not supported yet on the Windows platform.

David Hanak
+1  A: 

You can create a snapshot of the work using svn export and then creating your own subversion repository and use the snapshot from the work repository as the initial checkin.

Then you can make your changes and use subversion (your local repository copy) until your done. Of course you may do some regular merging from the main work repository to make sure your content is up to date. Lastly, when your refectoring is done simply do an svn export snapshot of your local repository and merge it back into your main work repository.

This is a bit crude but this is the only way to manage this type of work flow.

If you have regular enough access to work. You can create a branch of the content and work on the branch from the work repository exclusively and use the the local repository method when you need your extended undo functionality. At this point of course using a local version control system won't limit you to subversion so take your pick.

Jeremy Edwards
A: 

Nothing prevents from running local SVN server. I'm using it that way.

Joonas Pulakka
A: 

Git would be a good solution (because you can make and merge many branches very easily) but:

  • when re-importing your modification to svn, you should cleanup first the many intermediate branches you created under git;
  • git-svn does not work with the Windows distribution of Git, so you may want to use a Linux virtual image if you are working on Windows
  • If you can make git-svn running, use git2svn et svn2git ruby scripts, as described in this question
VonC
+1  A: 

I usually do like this:

  1. Get SVN repository as working copy.
  2. Initialize Git repository in this working copy.
  3. Hack hack hack;
  4. Commit to my Git repo.
  5. Update from company SVN.
  6. Resolve conflicts.
  7. Commit to company SVN repo a complete feature.
Marcin Gil
Do you do all SVN repository communications using some "vanilla" SVN client, or do you use any git/subversion integration tools at some point?
Niklas
TortoiseSVN exactly. Support for SVN in Windows MSysGit is not very well ported. I wouldn't risk destroying anything in company's repo - thus I use "standard" SVN client for "company" and Git for "me".
Marcin Gil
how about using a different version control system when work offline? e.g. VSS on local?
Cooper.Wu
@Cooper.Wu - that's what I use git for. It doesn't matter what "online" system is used. Locally I always hack with git.
Marcin Gil
+1  A: 

You may want to try SVK which a decentralized VCS based on subversion. It can be used to mirror the official repository on your laptop and the synchronize your commits with the official trunk.

Aaron Digulla
+1 because SVK was essentially designed to solve this problem (offline SVN commits). But unfortunately it has a different working copy format and will not work with TortoiseSVN.
Wim Coenen
:P Didn't know about TortoiseSVN ... oh well ...
Aaron Digulla