The piece on Version Control I wrote recently for MacUser magazine covered the basics of version control with GUI based programs. But what if your code editor doesn’t give you the ability to create repositories? In this case it’s easy to do the basic repository setup with Terminal and then use your code editor (e.g. Panic’s Coda) to perform the on going file/repository changes. Here’s a quick-start to setting up a repository, importing files to it and then checking out a repository all from the Terminal command line.

In Subversion Client/Terminal

  1. First, let’s create a repository in the OS X Sites folder and name it accordingly e.g. Site-Name_SVN. Launch Terminal, then type ‘svnadmin create Sites/Site-Name_SVN’ (where ‘Site-Name_SVN’ is the name of the repository you want creating).
  2. Import relevant/existing files if needed: from Terminal use this command: svn import Desktop/benfraincom/clients/FolderName file:///Users/benfrain/Sites/Site-Name_SVN/ -m “Initial files import”. Be sure to change the relevant paths e.g Desktop/benfraincom/clients/FolderName should be changed to the address the folder/files you want to import.
  3. Checkout a working copy to the folder you want to edit from e.g. Sites/benfraincom_SVN/WC/ In Terminal, do this by first moving to the directory you want the Working Copy to be in. So in Terminal for example, e.g. cd Sites/Site-Name_SVN and then type: svn checkout file:///Users/benfrain/Sites/Site-Name_SVN/ WC – again, change ‘benfrain’ for your username and ‘Site-Name’ for your site folder. This will create a folder ‘WC’ with the checked out files in them.

Now in Coda
In the Coda site setup window, enter the local folder e.g. Sites/benfraincom_SVN/WC/
Enter the source control url in the Source Control section e.g. file:///Users/benfrain/Sites/Site-Name_SVN

Get editing!