Introduction
I've used various version-control systems in the past and am quite convinced they are an essential tool for the modern programmer. However I've been a bit on the lazy side with using them for my own personal development at home.
Given that I've just rebuilt my development machine with the final version of Windows Vista, Office 2007 and associated developer tools I figured it was an opportune moment to check out this Subversion software everyone was on about. Seems to be quite hard to find anyone who'll say a bad word against it [smile]
One thing that put me off setting this sort of thing up at home was that almost all examples are client-server oriented. It's assumed that you have some file-server kicking around that you use to run the actual SCM software. I don't - I've just got a pair of desktop PC's and I don't have the money to set up a file server just yet (one day I will!). In my travels I came across this mini tutorial for setting up a local copy of SVN and TortoiseSVM. It seemed almost too easy so I gave it a go - the remainder of this journal entry is just an illustrated guide to how I set it up and started using it. I know there are lots of similar (and vastly superior) articles around, but I figured it might well be of use to someone. If it is useful, then please leave a comment saying so [wink]
Setup
Firstly, download the latest SVN (I'm using version 1.4.2). Next download TortoiseSVN (I'm using version 1.4.1.7992 64bit). Install SVN first, then install TortoiseSVN - no big surprises here, no complex configuration at all...
Simple Usage
- Create a folder that represents your repository - just a regular Windows folder in a convenient place is fine. In this folder, right-click to bring up the standard context menu, note that TortoiseSVN has added a couple of new entries. Select 'TortoiseSVN' then 'Create respository here...":
You'll be prompted for a file system, the default FSFS is fine: - Now create another folder to represent your working directory - You aren't supposed to modify the contents of the folder from step 1. Again, a regular folder in a convenient place is just fine.
We now begin working with this folder - create some files and starte editing them. At this point I'd choose to use the 'Install Project' feature of the DirectX SDK's Sample Browser. For the purpose of this example we just create a 'first_file.txt'. - Once the basic files have been created in the working folder you need to import them into the repository created as part of step 1:
- Next we delete all the files in the working directory. This isn't required at all, but demonstrates how things work - this might be how things look when you're starting a new work session and need to get the latest versions of all files you'll be working with...
- Now, with the blank folder we need to check out the files:
This brings up the following dialog:
Provided everything goes according to plan you'll get the following dialog:
Notice that the folder in the background now has a copy of the file we created previously and then deleted. It gets given a green tick icon to indicate that it's up-to-date. - With the current version checked-out and ready to use we can go about editing the files. For the purpose of this example just open up 'first_file.txt' and add a couple of new lines of text. Assume that we have now finished working and we want to commit our changes back to the repository:
Notice that the changed file no longer has a green tick - instead it's marked with a red exclamation mark. This system of icons makes it quite easy to tell which files have been modified in the current session and which may need updating or committing.
The following image shows the dialog summarising what is about to happen. Nothing is required here - just clicking through is fine.
If all goes according to plan (as it should!) then we get the following dialog (similar to the check-out one). Notice that the 'first_file.txt' icon has changed from red to green.
In the simplest case you can just repeat the above process as appropriate - for a few minutes playing around it's amazingly easy to get something functional up and running. Provides a nice platform for learning the more advanced functionality as you get more used to the system - things like multiple projects and versioning/branching...
Conclusion
There is a lot more to SVN than I've shown here, but as I'm sure you can appreciate it is very easy to get a capable SCM system up and running in next to no time [grin]
Hope the above was of interest and useful.