Working offline with SVN on local machine temporary

Karan picture Karan · Feb 8, 2011 · Viewed 17.7k times · Source

I am working on a project currently on SVN. I however will not have access to the internet for a few days, and will be working on my project.

Is there any way to make a clone of the repository on my local machine, commit changes to it, and when I gain access to the internet "push" them onto the shared repository? Thinking in terms of Mercurial here, is it worth migrating completely?!

Answer

eckes picture eckes · Feb 8, 2011

Your problem sounds to me like the use case for git-svn:

  • set up your Git repo: git svn clone http://svn.example.com/project/trunk
  • while being online, commit your changes to SVN
  • before going offline, do a git svn rebase to get your Git repo in sync with the SVN repo
  • while being offline, commit to the Git repo using git commit
  • when getting back online again, do a git svn dcommit to push your changes back to the SVN repo

I'm using this workflow daily!

You get two huge advantages doing so:

  • your complete SVN history is backed up in the Git repo and in every Git repo that gets cloned from that one
  • while being offline, you can view the commit messages, checkout other branches, etc.