Having per-repo untracked config using gitattributes ==================================================== This approach was presented by SethRobertson on #git. I haven't had a chance to play with it, and it has some caveats (see below), but it's a nice idea. First, read up on gitattributes. [One](http://jk.gs/gitattributes.html) [Two](http://progit.org/book/ch7-2.html). Pay attention to the smudge/clean filters. Create a local branch called "private", which contains your personal config. Setup script ------------ The following script sets up the the smudge/clean filters for all files in SUBDIR ```bash #!/bin/sh # # SUBDIR=z x=0 find $SUBDIR -type f | while read f do echo "/$f filter=private_$x" >> .gitattributes git config filter.private_$x.clean "/tmp/clean $f" git config filter.private_$x.smudge "/tmp/dirty $f" x=$(($x+1)) done ``` /tmp/dirty ---------- The smudge filter is executed on `git checkout`, and replaces the contents of every file identified by the setup script with the corresponding file from the "private" branch. ```bash #!/bin/sh git show "private:$1" ``` /tmp/clean ---------- The clean filter is executed on `git add`, and replaces the contents of the (locally modified) files identified by the setup script with their tracked versions from the current branch. ```bash #!/bin/sh git show "HEAD:$1" ``` Notes ----- Note that there's no way to tell *which* branch is being checked out. Therefore, before checking out out the "private" branch, you have to disable the filters. Renaming .gitattributes is one way of doing this. Also, SethRobertson alluded to the presence of an undocumented "%f", which would remove the need to create a separate smudge/clean filter pair for every file.