No, you can't cleanly commit a file inside a submodule (`B/`) to the parent repo (`A`) only. Git treats submodules as isolated repositories.
Workarounds:
Use Git subtrees instead of submodules.
Or, add the file to `B/`, ignore it in `B` via `.gitignore`, and commit it in `A` (not ideal).
Or, use symlinks pointing outside the submodule.
Subtrees are the cleanest solution for this use case.