I feel like I’m doing something wrong here (architecture-wise I know I am, but this is a simple project).
There are two ("three") sub-projects, living in the same folder (
- An Angular frontend (
- A Typescript (node.js) based backend (
- A shared "domain" directory that contains the DTOs (
From what I understand, in an ideal world, this would be three separate repos, with #3 being a git submodule of #1 and #2.
But this is a tiny project, and I am not in an ideal world, so I need to keep everything in the same git repo.
The current setup is that the "domain" directory (sub-project #3) is presented to both #1 and #2 via symlinks; i.e.
proj/lambda/code/domain both point to
Git doesn’t seem to handle this scenario very well out of the box.
Is there an option or flag (or a better method — without resolving to using mutliple repos) that I can utilize here?
git knows how to store and checkout symlinks, the thing is it stores the exact path you provided for your symlink.
(do double check if you are running Windows though)
Your setup should work if you provide relative paths for your symlinks (and if these path do not escape the repo) :
cd proj/ ln -nsf ../../../domain fe/src/app/domain ln -nsf ../../domain lambda/code/domain # on any checkout: the symlinks will point to that directory, two or # three levels higher than current directory
If you used absolute paths instead:
ln -nsf /path/to/proj/domain fe/src/app/domain ln -nsf /path/to/proj/domain lambda/code/domain
The checked out symlink will point to
/path/to/proj/domain — which is not what you want on a system other than your dev laptop.
Answered By – LeGEC
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0