views:

122

answers:

5

This is more a use-case question, but I generate static files for a personal website using txt2tags. I was thinking of maybe storing this information in a git repository. Normally I use RCS since it's simplest, and I'm only a single user.

But there just seems to be a large trend of people using git/svn/cvs/etc. for personal data, and I thought this may also be a good way to at least learn some of the basics of the tool. Obviously most of the learning is done in an environment where you collaborate.

So back to the question: how would you use use a version control system such as git, to manage a personal website?

+1  A: 

I version all of my data. I commit each time I change it.

Versionning my code allow a backup too.

shingara
A: 

For projects (even non-collaborative) I use trunk/tags/branches folders (I didn't when I started but learnt the hard way) but for personal file they really aren't necessary, especially as binary files can't be merged.

A commit after every set of changes I'm comfortable with is good enough for me.

Xian
`git` is not `svn`
hasen j
A: 

Use git. Git gives you the convenience of offline commits plus the ability to push changes to other machines. I keep my configuration files (screen, shell, emacs,...) in git to have them synchronized between my machines. Also makes it dead-easy to get your custom setup on a machine you're only temporarily using.

Split up projects into separate repositories (don't commit your home folder) as you can only pull whole repositories with git.

Florian Thiel
+1  A: 

Create a repository on your local system to contain the master copy of your files. Work on the site in your local repository and deploy the Web site to the live server directory whenever. You could use an existing tool for this, or write a small script with a build or export routine and file copying.

The last bit is good practice, but not everybody does it. Some people make the working copy of a repository clone Web-accessible instead. I don't recommend this - Git doesn't track file permissions, you shouldn't be doing VCS operations directly on the live copy of your Web site, and there is no reason to potentially expose a complete copy of your repository on the Web.

I use the Webby utility to build my site, and this includes a deployment function. Capistrano and Fabric are specialized deployment tools. I know that Capistrano works with your VCS to enable you to easily deploy and rollback your live sites.

I also have a clone of my repository on another system, which I push changes to - purely as a backup.

Stuart Ellis
A: 

Stuart,

I think your response addresses my question best. Would you or anyone be willing to elaborate on what you mean by writing a small script as a build or export routine. Would this just be something like a stage.sh that pushes all repository files related to my website to a directory?

I think I understand having not used GIT what you mean by permissions though. So working copy on the live webserver is bad idea. Got it. But should the aforementioned script then take this into account and also specify the permissions when copied?

Thanks for your insight.

nn
Yes, your deployment tool could just be a shell script that runs rsync or something to copy from a directory in your working copy to the Web site root directory on the server. The purpose of it is really to ensure that you have a consistent process that only publishes exactly the files that you want to appear on your public site.
Stuart Ellis
The permissions issue is that Git deliberately does not store full permissions of files or directories, so that if you use it as a synchronization tool between the development and live copies of your site you may have a nasty surprise.Rsync and other mirroring and deployment tools do handle permissions, so you just need to configure things correctly. Forcing a permissions reset probably won't be necessary unless you have an unusual situation.
Stuart Ellis