Using GIT on an SVN project

SVN is great, or maybe I have to say, version control is great.
It makes sure your code doesn’t get lost, keeps track of all the changes, makes collaboration easy, allows for efficient project management (linking changesets to tickets) and so on.
But for all these advantages to be really usefull, you should constantly commit your changes to the repository: bug/ticket closed => commit, feature implemented => commit, plugin/library updated => commit, …

Problem: you probably don’t have constant access to your SVN repository. You might be on the bus, SVN is blocked by your client’s firewall,…

In comes GIT, and more specific, GIT-SVN.

In case you haven’t heard of GIT before, it is a version control system like Subversion, but with some interesting differences. I’m not going into detail here, if you want to know more, you ’ll find a ton of info with Google.

Let’s set it up ! (I’m using Ubuntu, should be pretty similar on another OS…)

Install git and git-svn


  sudo apt-get install git
  sudo apt-get install git-svn

The easiest way is to check out your project from it’s SVN repository


  git-svn clone https://svn.repository.net/path/to/project/

This will import your project into a folder “project” in your current directory

Ok, now you’re ready to start using git

update your local project from the svn repository


  cd project
  git-svn rebase

Committing changesets with git

<code class="ruby">
  # display status, shows all new/modified files
  git status

  # if you have newly created files, you have to add them to the changeset to be committed next
  git add path/filename

  # commit a (local) changeset
  git commit -a
  # with the option -m "description", you can immediately set the commit message

Committing your local changesets to SVN


# All your local "git commits" will be commited in the SVN repository as seperate changesets
# It might be best to do a "git-svn rebase" first to load remote changes.

  git-svn dcommit

That’s it! Super-easy, but extremely usefull.

This is the basic usage ofcourse, you can do a lot more with git, like merging, branching, tagging, diffs, …

Some usefull resources / links:

Leave a comment



  • (required, but not published)


Entries per category

  1. 6 pages are tagged with docpublisher
  2. 4 pages are tagged with documentum
  3. 11 pages are tagged with events
  4. 12 pages are tagged with rails
  5. 24 pages are tagged with ruby