Sometimes it is useful to store more filesystem information in your Git commit, such as file/directory owner, directory permissions, etc. Not necessarily the same permissions git stores by default.
One case I found this useful for is storing our servers config in the Git repository. The idea is to have a master branch, which holds very basic system configuration, useful multiplatform (Linux/BSD/Solaris) shell scripts, a set of certificates, a Munin plugins submodule and so on, a number of child branches for each set of servers or OSes, and finally a Git branch per server.
In this scenario, useful information includes file and directory owner and permission information. Yes, Git stores file permissions bits, but when I clone our repository to my local machine I don’t need those restored; moreover I don’t want those to be overridden by my local ones.
Inspired by once found git-meta-fs script I decided to improve it to suit all our needs. The new shell script stores file metadata in the .gitmetafs directory. A file-per-file approach ensures minimal merging efforts between branches. The script also tries to solve various multiplatform issues, such as root:wheel on BSD vs root:root on Linux, nobody:nogroup differencies on Debian and CentOS and others.
The script uses Git hooks. The hooks should be installed on every machine having a Git repository; place the script into a permanent place and run
path/to/git-meta-fs init (or
path/to/git-meta-fs dev init on your dev machine). Some instructions you may find out by launching the script without arguments.