I'm working on a linux system with nested git repositories. My file/directory structure is as follows:
~/
.git/
.gitignore
file1
project/
.git/
file2
file3
In my homedir I have created a repo for my linux config files. The ignore file (~/.gitignore) contains only '*' (exclude everything). I have added files with 'git add -f file'. In a nested repo (project) I have discovered that everything is excluded as well even though the correct '(~/project/).git' directory is updated on commit. I have checked this with the following command:
> cd ~/project
> git add file2
The following paths are ignored by one of your .gitignore files:
file2
Use -f if you really want to add them.
fatal: no files added
> git check-ignore -v file2
~/.gitignore:1:* file2
The command check-ignore is available as of version 1.8.2 and was motivated by the stackoverflow question: which gitignore rule is ignoring my file.
My question is if there is a way to change the behaviour git regarding ignore files to only process the ignorefiles encountered until the repo is found that git commits to, e.g., stop processing ignorefiles higher up in the directory structure than the first '.git' folder is found (in this case ~/project/.git).
Thank you!