Wolph

Using git for offline svn access

Once in a while I have to work on projects that still use Subversion, it doesn’t happen that often but it does. And while svn isn’t that bad to work with, it does require an internet connection to make commits.

Initial checkout

Getting the initial codebase from svn:

[bash]git svn clone https://some_server/some_repo local_path[/bash]

This can take a while on a large repo, so get a coffee in the mean time 😉
Alternatively… you can also checkout a portion of the revisions instead of all of them (comparable to “git –depth”) like this:
[bash]git svn init https://some_server/some_repo local_path
git svn fetch -r some_svn_revision_number[/bash]

Staying up to date

First make sure we’re still working on the master branch:
[bash]git checkout master[/bash]

And after that:
[bash]git svn rebase[/bash]

Pushing back to subversion

[bash]git svn dcommit[/bash]

 

Et voilà, a subversion repository which you can also use offline.

Exit mobile version