Using git for an svn repository

After a couple of years of quite disliking the version control software git I’ve finally got used to it and think it’s alright. In fact I’m now using git to access an svn repository with git-svn. Here are just some reminder tips for myself (in part taken from here):

Cloning an svn repository:

git svn clone url_of_svn_repository

Adding and committing to your (local) git repository (this is just like standard git):

git add my_file
git commit -a -m "My commit message"

Committing those commits to the svn repository (like git push):

git svn rebase
git svn dcommit

Removing files from the svn repository (pretty much as above, but the file most be removed first!):

# remove the file
git rm my_file
# commit the removal
git commit -a -m "Removed file"
# commit the changes to the svn repository
git svn rebase
git svn dcommit

There probably a lot more I can do (like adding and merging branches), but this is enough for me at the moment.

Leave a Reply