GitSvn

Saving and handing in your homework using git and svn:

Using the 'git' version control program is great for saving and tracking changes to your code locally, on your computer, especially when you can't access your subversion repository because you're temporarily without internet.

If people in our class would like, they can use git and subversion together, using git to save changes locally when they don't have net access, and then sending their changes to their subversion repositories when they have net access again.

The first step is to "clone" your remote svn repository to a local git repository. The second step is the usual cycle of editing your code, adding and removing and moving files as needed, and then "committing" your code to your local git repository. The third and fourth steps are to send your changes from your local git repository to your remote subversion repository, and to retrieve changes from the remote repository to the local repository.

A really simple workflow for our class would look like this:

$ git svn clone http://class.ged.idyll.org/svn/<username>
$ cd <username>
$ mkdir homework3
$ git add homework3
$ cd homework3
$ cp /some/other/path/homework-file ./echo-server-nb
$ git add echo-server-nb
$ git commit -m "Added nonblocking echo server for homework 3."

The next command sends changes (that were previously committed using git) to subversion:

$ git svn dcommit

There's also a command to pull changes from the subversion repository to the local git repository:

$ git svn rebase

This is how we would retrieve changes that the teacher or a TA has added to our code in the subversion repository, such as inline comments.

This workflow is adapted from the manual-page at

http://www.kernel.org/pub/software/scm/git/docs/git-svn.html

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License