Git tracks symlinks the same way it tracks files. It'll record the contents of the symlink (the path it points to) as a blob, and then record the symlink itself with a special mode to indicate that it is a symlink. This means that if your symlink points outside of the repository, nothing pointed to by it will even be examined by git. And if it symlinks another dir in the repo, but the contents of that dir are excluded via your gitignore, anything inside the dir will still be excluded. With this in mind, it appears from your diagram that dir2 is likely to be pointing outside of the repository, and so dir4 is never even seen by git. -Kevin Ballard On Sep 22, 2010, at 9:41 AM, Jonathan Gossage wrote: > I am having a problem specifying .gitignore filters properly > I have a directory structure as follows: > > repo-root > | > ------------------------------------------------------------------- > | | > | > dir1 dir2 (symlink) > dir3 > | > --------------------------------------------------- > | | > many directories and files dir4 > > My problem is that I want to exclude all files and sub-directories in dir2 > except for dir4 from control by Git. > I tried a number of variations on the following .gitignore file in dir2 but > either everything was excluded or everything was included. I tested using > git add -uall -n > > The final .gitignore file was > * > */* > !dir4 > > > How should I go about tackling this. The .gitignore man pages were > unclear to me. > > Jonathan Gossag-- > To unsubscribe from this list: send the line "unsubscribe git" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html > e -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html