Using git-svn (in ArchLinux)

Preparing ArchLinux for git-svn

To use git-svn, we need to install some packages. Although the commands and the packages are specific for Arch, they might/will give a hint for what to install on other platforms as well.

Open a terminal and install git, subversion, and pert-term-readkey:

sudo pacman -S git subversion perl-term-readkey

git is used for... well... GIT. Subversion provides git the possibility to manage an SVN repository. FInally, perl-term-readky helpt git to work with svn repositories protected by passwords.

 

GIT has a graphical interface ready for you. It depends on the tk toolkit. Install the tk toolkit by

sudo pacman -S tk

and type gitk for the graphical interface.

 

My workflow

I based my workflow on the tips from these websites: 1, 2, 3, 4, 5.

/* Checkout the repository */
git svn clone -s <path to repository>

/* Build your .gitignore file (add other ignores, see http://www.hanckmann.net/?q=node/51) */
git svn show-ignore >> .gitignore

/* Create a new branch */
git checkout -b feature-branch
 
/* Work work work */
git add -A
git commit -m "Implementing super-awesome feature!"
 
/* Now to be sure I still have the latest code from SVN */
git checkout master
git svn rebase
 
/* Now I rebase my feature branch so that it has the latest... */
git checkout feature-branch
git rebase master
 
/* And finally, I push my changes to SVN. */
git svn dcommit
 
/* And I'm done! */
git checkout master
git svn rebase
git branch -d feature-branch

A small note on branching

I had the issue where I created a local (git) branch, but then decided to check it in into SVN as a (remote svn) branch. The answers to this... and the prefered way of planning to branch before doing so... are described here.

© 2008 - 2014 Patrick Hanckmann

View Patrick Hanckmann's profile on LinkedIn