I have a problem with git add .
failing to add files. I believe (in fact, I'm sure) this is related to the fact that my local repository is located in a subdirectory of the worktree. git add --all
works, but I'd like to understand what's going on here.
In the worktree
directory I have two files and one repository subdirectory: ignore.txt
, do-not-ignore.txt
and repo
. Inside worktree/repo
is .git
. I set git config core.worktree '/absolute/path/to/worktree'
. The content of .git/info/exclude
is:
*
!do-not-ignore.txt
When I run git status
from within worktree/repo
I get (with the usual message):
../do-not-ignore.txt
However, git add .
does not do anything: running git status
after git add .
gives me the same result as above. git add --all
, on the other hand, adds the file correctly. If I just move .git
from worktree/repo
to worktree
everything works as expected.
Can someone, please, explain (or provide a link about) this behavior? Thanks.