Building notes, projects, and occasional rants

My current git setup

I've been using git for more than an year now, and I've settled on a repository organization that I like.

The foundations of this setup are:

For each project I have, I keep the repository on all my computers in the ~/work/ directory. Those repositories are synced between work computers (desktop at the office, and laptop everywhere else) using a Unison profile.

The use of Unison gives me the possibility of leaving work half done in the desktop, and finish up at home if I feel like it, without having to commit and push from one to the other.

On each repository, I have two main remotes configured.

The origin remote points to my gitosis setup. You can use my gitosis install how-to for a painless setup. In addition, I add a Host entry to my ~/.ssh/config like this:

Host git
  HostName hostname.of.server.with.gitosis
  User git

This allows me to use a simple git:melo/repo.git as a remote URL. Short and to the point.

The second remote, named github, is only created on public repositories, and points to my GitHub account.

Manually I add a third remote named all. I copy the other two remotes urls to it. This allows me to git push all and have my changes pushed to both remotes with a single command. For example, for the AnyEvent::Mojo project, I have this .git/config file:

[remote "origin"]
    url = git:perl/anyevent-mojo.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[remote "github"]
    url = [email protected]:melo/anyevent--mojo.git
    fetch = +refs/heads/*:refs/remotes/github/*
[remote "all"]
    url = git:perl/anyevent-mojo.git
    url = [email protected]:melo/anyevent--mojo.git

This setup gives me peace of mind (all my code ends up on 4 different systems), and provides a pretty face (Github) for other to use.

Next step: create a script to make all this a one-step process.