I read 'Pragmatic version control with Git last night' (recommended) and as a result was thinking about changing my dev environment as I walked into work. There is one of my current CVS setup I can't see how to replicate using git.
Let me explain what I have now.
> ls ~/Workspace moodle_16 moodle_18 moodle_17 moodle_19 moodle_head
That is my Eclipse workspace, and each of those folders is a CVS checkout of a different Moodle branch. As I understand it, you would not do that with git. Instead, the official line is that git makes jumping from one branch to the other is so quick and easy, so you only need one checked out copy of the code. Also, the workspace contains a copy of your repository, so just one is easier.
However, in order to be able to conveniently test each version, I have my web server set up like this:
tim@tim:/var/www$ ls -l /var/www lrwxrwxrwx 1 root root 29 2009-01-12 12:54 1.6 -> /home/tim/Workspace/moodle_16 drwxr-xr-x 8 www-data www-data 4096 2009-01-12 12:52 1.6data lrwxrwxrwx 1 root root 29 2009-01-12 12:54 1.7 -> /home/tim/Workspace/moodle_17 drwxr-xr-x 9 www-data www-data 4096 2009-01-12 12:52 1.7data lrwxrwxrwx 1 root root 29 2009-01-12 12:54 1.8 -> /home/tim/Workspace/moodle_18 drwxr-xr-x 9 www-data www-data 4096 2009-01-12 12:52 1.8data lrwxrwxrwx 1 root root 29 2009-01-12 12:54 1.9 -> /home/tim/Workspace/moodle_19 drwxr-xr-x 18 www-data www-data 4096 2009-02-17 13:54 1.9data lrwxrwxrwx 1 root root 31 2009-01-12 12:54 moodle -> /home/tim/Workspace/moodle_head drwxr-xr-x 16 www-data www-data 4096 2009-02-11 15:51 moodledata
That means that I can test Moodle 1.9 by going to http://example.com/1.9/ and test Moodle 2.0 dev by going to http://example.com/moodle/ and so on. In each of my workspaces, I have a config.php like /home/tim/moodle_19/config.php with the appropriate paths and database prefix, and the config.php files are in .cvsignore. This is very convenient.
(I am also being bad, since moodledata if accessible from the web, but it's only a dev box.)
Obviously, you could not do this with a single git workspace. Any suggestions?
(I think I could write a config.php that reads version.php and sets paths and DB prefix according to which branch you currently have checked out, which would let you always test the code you are currently working on, but sometimes when I am changing something in HEAD I want to see how it used to work in 1.9.)
(Why does the HTML editor screw up whitespace in <pre>?)