« Lighthouse and GitHub | Got a MobileMe Account this Weekend »
2 July 2008
I am going to be on a plane tomorrow and the next day so I wanted to do some work on Django Photo Gallery but still wanted to commit changes to the repository while offline. So this is a quick overview on how I am going to do this.
First I need to checkout the repository:
git-svn init -s http://username@example.org/svn/project-name project-name --trunk=trunk --branches=branches --tags=tags
Lets cd into that directory and fetch the changes from the subversion repository:
git-svn fetch
If you have any branches or tags on the subversion repository you can see them with:
git-branch -a
If your subversion repository has a lot of commits then it would be a good idea to repack the repository which will make you git repository smaller and have a lot less files:
git-repack -d
Okay now lets make a new branch to make our changes; because I am going to be traveling I am going to call my branch air_plane_commits (a better name would be a ticket number or a feature):
git-checkout -b air_plane_commits
Now use Git as you would normally.
When you are back home you can commit you changes back to the subversion. Change to the master branch and merge your changes branch.
git-checkout master
git-merge air_plane_commits
You might need to fix some merge conflict, but probably not. Now we need to rebase our changes to the current subversion commit if there are other developers working on the same repository.
git-svn rebase
Now lets commit our changes to the subversion repository:
git-svn dcommit
Comments have been close for this post.