Using Git with Subversion: Part I (Installation)

You can use Git with a Subversion repository to get some of the Git goodness, local branches, stashes and much more, without having to persuade everyone else on your project to migrate to Git

Install Git

You need to install git-svn first, with MacPorts this is as easy as

sudo port install git-core +svn +bash_completion

And then to enable bash completion (thanks to Graham Ashton for this tip)

cp /opt/local/etc/bash_completion.d/git ~/.git-bash-completion.sh
echo '[ -f ~/.git-bash-completion.sh ] && . ~/.git-bash-completion.sh' >> ~/.profile
. ~/.profile

And for those without macports here are some installation instructions

TextMate integration

If you use TextMate then install the Git Bundle

And you can set TextMate as the editor for git commit messages by adding the following to ~/.profile

export GIT_EDITOR="mate -w"

Basic git configuration

You should tell git who you are.

git config --global user.name “your name”
git config --global user.email “your.email.address@foo.bar”

If you are on OS X, then tell git to ignore .DSStore files in all your projects.

git config --global core.excludesfile .gitexcludes

And create a file ~/.gitexcludes with ‘.DSStore’ in it.

This all you need to configure but there’s much more you can do with git config e.g. aliases for git commands if you want to save those typing fingers.

Coming soon

Using Git with Subversion - Part II (Practice)

Tags:

Leave a Reply