tags:

views:

129

answers:

2

I'd like to combine two or more directories in one git repository. These repositories are logically linked but belong to different filesystem paths, e.g. /etc/httpd and /var/named/chroot/var/named both contain virtual host data which I'd like to manage as a whole, but I can't link them.

I've asked the git mailing list but had no luck.

Suggestions?


Update: I don't use this mechanism for deploying code, I just find it's a very convenient way of :

  • tracking changes as they happen, so that I can very easily git checkout to a previous known stable point and event git bisect configuration problems.
  • staging changes in a separate directory and then pulling from that directory when the time has come to perform the change.
+2  A: 

The best way to do this is to write a script that deploys the files, and use Git to manage the source for the project. If you have more sophisticated needs then management tools like Puppet integrate with version control.

Direct Git checkouts are not a good way to do deployment - it was not intended for this. You can avoid the issue of having repositories on target systems by using the export facility, but by design Git does not store full permission/ACL data for files.

Stuart Ellis
Thanks for the answer. I don't actually 'deploy' using git, I just have /etc set up under version control, and I clone it to stage changes, and then pull when the need arises.I do this more for history and tracking than for deployment.
Robert Munteanu
It's probably worth taking a look at etckeeper, and then thinking about your service config files as special cases. etckeeper runs a repository for /etc (DVCS of your choice) and enhances the distro package manager to work with it.
Stuart Ellis
Looks intriguing, I'll take a look.
Robert Munteanu
+2  A: 

Perhaps you could set up a Git repository with multiple disjoint branches, one for each distinct directory tree you want to track. I'm not sure whether this arrangement would satisfy all your requirements, but it would allow you to keep the different directories in the same repository.

Greg Hewgill
How would you set up a GIT repository with "multiple disjoint branches?" Please excuse my ignorance...
Yar
@yar: See "Creating New Empty Branches" in the Git book: http://book.git-scm.com/5_creating_new_empty_branches.html
Greg Hewgill