how to put existing directories under subversion control

useful for configuration directories and existing source code…

for this example, we’ll assume that the directory to be protected via version control is ~/.irssi with the configurations, scripts, etc. for irssi.

if needed, create a repository. let’s use the new directory, ~/svnrepo:

svnadmin create ~/svnrepo

it’s handy to have the svn repo in an environment variable:

echo "export SVNROOT=file:_/$HOME/svnrepo" >> ~/.bashrc

be paranoid; back it up first:

cd ; tar zcf irssi.tgz .irssi

import the directory:

cd ; svn import .irssi $SVNROOT/.irssi

make the directory a working copy:

cd .irssi ; svn co --force $SVNROOT/.irssi

this will caus a lot of E flags that can be ignored.

if desired, double check with:

mv .irssi
tar zxpf irssi.tgz
diff -qr .irssi_ | egrep -v '\.svn'
rm -rf .irssi
mv .irssi
rm irssi.tgz

updated: Fri Nov 12 11:00:18 PST 2010