command sequence
mkdir topdir
mkdir another-git-directory
touch fileC
touch fileD
git add .
git commit -m "sub-dir init"
cd ..
touch fileA
touch fileB
git add .
git commit -m "top-dir init"
git ls-files
// now we can see that fileC and fileD is not tracked by top-level git //
git ls-files -o
// this would not show us the fileC and fileD as untracked files//
my question is: how can we make "git ls-files -o" to show the untracked files inside sub-directory? why git is behaved such, as i expect git ls-files to show all untracked file (even it is inside another sub-dir git)?
I know that I could make the top git to track the sub-dir files using "git add */."... but I am interested to know why for the question above. Thanks!
directory structure
topdir + +-- .git +-- fileA +-- fileB + another-git-directory +-- .git +-- fileC +-- fileD
update (26 Jun)
I found this thread http://stackoverflow.com/questions/1084969/unable-to-track-files-in-deep-directories-by-git and this url (cn) http://blog.ossxp.com/2010/01/425/ which explains how to resolve the problem.
the solution:
git rm --cached another-git-directory #no trailing slash
git add another-git-directory/.
git commit
the 'git rm --cached path/to/sub-dir-or-sub-module' will tell the top-dir not to treat the sub-dir as a submodule... I think....