Monday, March 30, 2009

Using git push

I'm starting to use git for some actual work, and am making tentative steps towards not totally sucking at it.

Right now, I'm trying to get a handle on working with remote repositories. In theory, because git is fully distributed, you don't need a central repository. However, I want to use remote repositories to (1) ensure my data is backed up (I have access to a Solaris server with a RAID and regular disk backups), and (2) allow easy synchronization of my work between the various machines I use (office PC, laptop, etc.)

The main idea with git is that repositories and working directories should be inseparable; all work should be versioned. Being a distributed VCS, git gives you lots of ways to synchronize changes between repositories. All well and good.

However, weirdness ensues when you consider what git should do when you push (commit) changes from a local repository to a remote repository. If you push into a remote repository that has a working directory checked out from the branch that you are pushing into, git does weird things. I won't even attempt to describe what happens, since I don't understand it. Suffice it to say that it's not a useful behavior.

One solution, as helpfully pointed out by the git cvs migration help file, is to create the remote repository as a "bare" repository, meaning that it does not have an associated working directory. So, the series of steps is something like:
server$ cd /some/directory && git --bare init

client$ git clone username@server:/some/directory
[ add some files ]
client$ git add files...
client$ git commit -m"Added some files..."
client$ git push origin
The "origin" in git push origin evidently refers to the remote repository from which the local repository was cloned.

Sunday, March 29, 2009

Good book on git

I found a good book on the git distributed version control system:

Pragmatic Version Control Using Git

This is the first good introduction to git (and to distributed version control in general) that I've seen.

Thursday, March 26, 2009

An addictive game

Beware: this is a potential time sink. [for Windows systems]
See the included README.txt for details.