Question on opam, dune, and managing multiple projects in git submodules

What are people doing to manage dependencies when a repository contain multiple dune projects (possibly in git submodule)?

For example I have dir1/foo.opam that has some opam dependencies, but depends locally on dir2/bar.opam, that also has some opam dependencies. I would like to add “bar” as a dependencies in foo.opam but really “bar” is not a package pushed yet on opam, and dune build will correctly compile bar and foo. It’s just that for dependencies, I have to run opam install --deps-onl dir1/foo.opam, and opam install --deps-onl dir2/bar.opam, where really I would like something like:
opam pin bar ./dir2;
and opam install -deps-only foo/ will also install the dependencies in bar, but right now instead it tries to compile bar and make it an OPAM package locally.

If i understand well, you want to automatically manage bar when installing foo.
If you put in your foo opam file a pin-depends: field, it will automatically pin, install, and update your local bar package:

depends: { "other" "dependencies" "bar" }
pin-depends: [ "bar.myversion" "git+file:///path/to/bar" ] # or file:/// if path pinned