Git

Joey Hess joey at kitenet.net
Mon Nov 26 03:45:02 CET 2007


chombee wrote:
> So is anybody successfully versioning their homedir with git? And do
> they have any advice?

I've been using git for the lion's share of my home directory for a
while now.

> Some people on the git irc channel are very against this idea. They
> think you're crazy, will outright tell you not to do it, and even
> threaten to stop speaking to you if you continue doing it.
> Their reasoning seems to be that you're not using git for what it was
> intended for

Sadly, it's best to ignore this attitude, even if they are useful
contributors to git in general. Although if you really want to rile them
up, keep /etc in git too. :-)

> * Don't make the git repository directly in your homedir. You don't
> want git operating on 'live' config files, as this isn't what git was
> designed for, and who knows what might happen. If git dumps some merge
> conflicts into a config file while the file is in use, you could break
> your system.

This could happen with svn too. The worst case I can think of would be
if .profile has merge markers that the shell thought looked kinda like
redirection. I've never seen the merge markers truely break something
like that in several years of using svn for my home. The worse I see is
a web browser or music player failing to start because it can't parse
its config.

Anyway, there are plenty of places that merge markers could be inserted
into files in a linux kernel tree, or other thing that git is
semi-intended to be used for, with similar potential for bad results if
you type 'make' at the wrong point.

I'd draw the line at (non-fast-forward?) merging into /etc. I like my
passwd file. Anything else, I can recover from..

Of course if you feel safer copying stuff around, that's fine too, I
think it would be too annoying for me though.

> Also if you do this, then you have to abuse the gitignore file a lot to
> get git to ignore everything that you're not versioning.

That isn't abuse, it's a useful reminder of new dotfiles that you've
forgotten to check in.

> * Git doesn't track file metadata. If you care about this, I think you
> can script around it. Git supports executing custom scripts as
> pre-commit and post-checkout hooks. I think you could have a
> pre-commit script that reads file metadata and stores it somewhere
> inside the git repository, either in the content of the files
> themselves, or in a central metadata file. A post-checkout script
> could then read this stored data and reset it. Once they're setup you
> don't need to think about these scripts, just use git normally.

There's a nice package called metastore that does this, adding a
.metadata file that can be checked in to git. I use it for /etc, but I
don't currently use it for my home directory since I like the safety of
having a script I can run to fix up all permissions to files that
shouldn't be world readable, and since my home directory needs to be
checked out on many systems where I don't have root and can't trivially
install it. (It's annoying enough installing git on some of those.)


I'd recommend taking some care at how you split the different parts of
your home directory into different git repositories. One big repo is not
a good idea. I have .. 89 repos checked out total, although the core of
my home directory is really only 9:

joey at kodama:~>mr -n 1 ls
mr list: /home/joey/		# just enough to bootstrap the rest

mr list: /home/joey/.cron	# crontabs

mr list: /home/joey/.etc	# dotfiles I need everywhere

mr list: /home/joey/.hide	# stuff for trusted machines only

mr list: /home/joey/.plus	# dotfiles/dirs that use lots of space,
				# only for machines with reasonable disk

mr list: /home/joey/doc		# private notes, etc

mr list: /home/joey/lib		# various cruft..

mr list: /home/joey/mail	# 1 gb of mail archives, going all the
				# way back to 1995.

mr list: /home/joey/src		# misc source code and a .mrconfig
				# to check out 80-odd other source repos

mr list: finished (9 ok; 3 skipped)

-- 
see shy jo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.madduck.net/pipermail/vcs-home/attachments/20071125/4766a2eb/attachment.pgp>


More information about the vcs-home mailing list