[announce] colgit: manage git repository collections
- From
- martin f krafft <madduck@madduck.net>
- Date
- Sep 6, 2007, 10:11 UTC
- Message-ID
- <20070906101115.GA29360@piper.oerlikon.madduck.net>
[Ob crosspost: please keep vcs-home on Cc all times. Please remove git mailing list from Cc when the reply isn't enough about git]
Dear colleagues,
Last night, while Andy Roddick was giving his best against bored world champion Roger Federer (and still lost after a game of many crazy shots), I reached what I think is a milestone in my attempt to let git manage my home directory across several machines. I called it colgit, which attempts to hint at "collection of gits", and this is the birth announcement of this shell script.
http://git.madduck.net/v/bin/colgit.git
The problem I am trying to solve is that I maintain different projects in different repos, including scripts in ~/.bin and configuration files, and that I use multiple computers on a daily basis. Moreover, I might happen upon a new computer which I have to use for a few days and would like to be able to set up my account easily.
With SVN, I'd have a repository for each machine, which existed only of svn:externals references pulling in other repos and thus assembling my home directory. git-submodule isn't quite designed for this sort of stuff, and thus I came up with colgit.
The idea is simple: ~ is a git repository with a .colgit/ directory, which hosts a hierarchy of directories holding a selection of files from .git directories. For instance, ~/.colgit/.etc/mutt/config is the git-config file for the repository that I want to have in ~/.etc/mutt. Since all of ~/.colgit is checked in to the repo in ~, I can easily clone that for another machine, or branch from it and add yet other repositories, or remove some.
Each directory in ~/.colgit can also hold hooks, description, and info/exclude, which are used to seed the repository in the plain ~ hierarchy. Right now, the design requires a central repository and appropriate remote.origin.*/branch.master.merge entries in the config file so that it can initialise repositories on new machines.
colgit currently is still very much a hack, but it already sports the following commands:
update/init: for each leaf directory in ~/.colgit, create the corresponding repository in ~, seed it, and run git-pull. If the respository already exists, just pull.
register: given an existing repository somewhere under ~, obtain the relevant config files from its $GIT_DIR and populate the corresponding directory under ~/.colgit.
status: for each leaf directory in ~/.colgit, query the corresponding repository in ~ and note to stdout if it has local changes
I also envision the following commands:
add: given a repository URL and a local path, clone the repository and run register
do: run the given git commands over each known repository
The process of initialising an account on a remote machine thus becomes:
git clone -n ssh://.../machines/base temp && mv temp/.git ~ cd ~ && git checkout HEAD ... colgit init
This is release early release often, so it's far from perfect and and probably buggy. But suggestions and patches are welcome!
-- martin; (greetings from the heart of the sun.) \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck # vim:tw=70 spamtraps: madduck.bogus@madduck.net