简体   繁体   中英

Why won't git ignore a bin folder in my submodule?

Git isn't correctly ignoring a bin folder of one of my submodules. Any ideas why?

Here is git status in the submodule:

MBPR:$ git status
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   bin/
#   gen/

Here is git status in the root:

MBPR:$ git status
# On branch develop
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#   (commit or discard the untracked or modified content in submodules)
#
#   modified:   cwac-loaderex (untracked content)
#

Here is my .gitignore:

MBPR:$ cat .gitignore
.metadata
bin
gen
local.properties

This works correctly for other submodules, but for this submodule in particular it refuses to ignore the bin and gen folders. I have deleted and re-added this submodule repeatedly, to no avail.

Thanks!

Each submodule being a full repo on its own, I would expect a .gitignore from a parent repo to not apply to a submodule.

That would mean you would need to add a .gitignore in the submodule cwac-loaderex in order to actually ignore those directories.

But even if the parent-level .gitignore does apply to the submodule, its rules (to ignore directories ) should be:

MBPR:$ cat .gitignore
.metadata
bin/
gen/
local.properties

Note the ' / ' after bin or gen .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM